@@ -486,6 +486,24 @@ class TestContext:
486
486
Unit tests for `OpenSSL.SSL.Context`.
487
487
"""
488
488
489
+ @pytest .mark .parametrize (
490
+ "cipher_string" ,
491
+ [
492
+ b"hello world:TLS_AES_128_GCM_SHA256" ,
493
+ "hello world:TLS_AES_128_GCM_SHA256" ,
494
+ ],
495
+ )
496
+ def test_set_ciphersuites (self , context , cipher_string ):
497
+ """
498
+ `Context.set_ciphersuites` accepts both byte and unicode strings
499
+ for naming the ciphers which connections created with the context
500
+ object will be able to choose from.
501
+ """
502
+ context .set_ciphersuites (cipher_string )
503
+ conn = Connection (context , None )
504
+
505
+ assert "TLS_AES_128_GCM_SHA256" in conn .get_cipher_list ()
506
+
489
507
@pytest .mark .parametrize (
490
508
"cipher_string" ,
491
509
[b"hello world:AES128-SHA" , "hello world:AES128-SHA" ],
@@ -509,6 +527,14 @@ def test_set_cipher_list_wrong_type(self, context):
509
527
with pytest .raises (TypeError ):
510
528
context .set_cipher_list (object ())
511
529
530
+ def test_set_ciphersuites_wrong_type (self , context ):
531
+ """
532
+ `Context.set_ciphersuites` raises `TypeError` when passed a non-string
533
+ argument.
534
+ """
535
+ with pytest .raises (TypeError ):
536
+ context .set_ciphersuites (object ())
537
+
512
538
@pytest .mark .flaky (reruns = 2 )
513
539
def test_set_cipher_list_no_cipher_match (self , context ):
514
540
"""
0 commit comments