@@ -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,13 +519,16 @@ 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+ @pytest .mark .parametrize (
523+ "set_cipher_method" , ["set_cipher_list" , "set_ciphersuites" ]
524+ )
525+ def test_set_cipher_wrong_type (self , context , set_cipher_method ):
505526 """
506- `Context.set_cipher_list` raises `TypeError` when passed a non-string
507- argument.
527+ `Context.set_cipher_list` and `Context.set_ciphersuites`
528+ raises `TypeError` when passed a non-string argument.
508529 """
509530 with pytest .raises (TypeError ):
510- context . set_cipher_list (object ())
531+ getattr ( context , set_cipher_method ) (object ())
511532
512533 @pytest .mark .flaky (reruns = 2 )
513534 def test_set_cipher_list_no_cipher_match (self , context ):
0 commit comments