@@ -486,6 +486,24 @@ class TestContext:
486486 Unit tests for `OpenSSL.SSL.Context`.
487487 """
488488
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+
489507 @pytest .mark .parametrize (
490508 "cipher_string" ,
491509 [b"hello world:AES128-SHA" , "hello world:AES128-SHA" ],
@@ -501,14 +519,22 @@ def test_set_cipher_list(self, context, cipher_string):
501519
502520 assert "AES128-SHA" in conn .get_cipher_list ()
503521
504- def test_set_cipher_list_wrong_type (self , context ):
522+ def test_set_cipher_wrong_type (self , context ):
505523 """
506- `Context.set_cipher_list` raises `TypeError` when passed a non-string
507- argument.
524+ `Context.set_cipher_list` raises `TypeError` when
525+ passed a non-string argument.
508526 """
509527 with pytest .raises (TypeError ):
510528 context .set_cipher_list (object ())
511529
530+ def test_set_ciphersuites_wrong_type (self , context ):
531+ """
532+ `Context.set_ciphersuites` raises `TypeError` when
533+ passed a non-string argument.
534+ """
535+ with pytest .raises (TypeError ):
536+ context .set_ciphersuites (object ())
537+
512538 @pytest .mark .flaky (reruns = 2 )
513539 def test_set_cipher_list_no_cipher_match (self , context ):
514540 """
0 commit comments