diff options
Diffstat (limited to 'OpenSSL/test/test_ssl.py')
-rw-r--r-- | OpenSSL/test/test_ssl.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/OpenSSL/test/test_ssl.py b/OpenSSL/test/test_ssl.py index 95cb538..a30e369 100644 --- a/OpenSSL/test/test_ssl.py +++ b/OpenSSL/test/test_ssl.py @@ -1057,10 +1057,11 @@ class ContextTests(TestCase, _LoopbackMixin): # XXX What should I assert here? -exarkun - def test_set_cipher_list(self): + def test_set_cipher_list_bytes(self): """ - :py:obj:`Context.set_cipher_list` accepts a :py:obj:`str` naming the ciphers which - connections created with the context object will be able to choose from. + :py:obj:`Context.set_cipher_list` accepts a :py:obj:`bytes` naming the + ciphers which connections created with the context object will be able + to choose from. """ context = Context(TLSv1_METHOD) context.set_cipher_list(b"hello world:EXP-RC4-MD5") @@ -1068,6 +1069,18 @@ class ContextTests(TestCase, _LoopbackMixin): self.assertEquals(conn.get_cipher_list(), ["EXP-RC4-MD5"]) + def test_set_cipher_list_text(self): + """ + :py:obj:`Context.set_cipher_list` accepts a :py:obj:`unicode` naming + the ciphers which connections created with the context object will be + able to choose from. + """ + context = Context(TLSv1_METHOD) + context.set_cipher_list(u"hello world:EXP-RC4-MD5") + conn = Connection(context, None) + self.assertEquals(conn.get_cipher_list(), ["EXP-RC4-MD5"]) + + def test_set_cipher_list_wrong_args(self): """ :py:obj:`Context.set_cipher_list` raises :py:obj:`TypeError` when passed @@ -1080,7 +1093,7 @@ class ContextTests(TestCase, _LoopbackMixin): self.assertRaises(TypeError, context.set_cipher_list, object()) self.assertRaises(TypeError, context.set_cipher_list, b"EXP-RC4-MD5", object()) - self.assertRaises(Error, context.set_cipher_list, b"imaginary-cipher") + self.assertRaises(Error, context.set_cipher_list, "imaginary-cipher") def test_set_session_cache_mode_wrong_args(self): |