diff options
author | Maximilian Hils <git@maximilianhils.com> | 2021-02-17 20:06:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-17 13:06:26 -0600 |
commit | 614d6737d84294b038eead384100e2a7a65f717b (patch) | |
tree | 2ce470d6e95682274d762dae0b589ebaebc69ea2 /tests | |
parent | d182dab3f7b51c3f3d5c13687f1abba81acd78e4 (diff) | |
download | pyopenssl-git-614d6737d84294b038eead384100e2a7a65f717b.tar.gz |
Check return code of SSL_[CTX_]set_alpn_protos (#993)
* check return code of SSL_CTX_set_alpn_protos, fix #992
* paint it black!
* fix line lengths as well :upside_down_face:
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_ssl.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_ssl.py b/tests/test_ssl.py index 8fdcae2..27f2d43 100644 --- a/tests/test_ssl.py +++ b/tests/test_ssl.py @@ -1888,6 +1888,15 @@ class TestApplicationLayerProtoNegotiation(object): assert server.get_alpn_proto_negotiated() == b"spdy/2" assert client.get_alpn_proto_negotiated() == b"spdy/2" + def test_alpn_call_failure(self): + """ + SSL_CTX_set_alpn_protos does not like to be called with an empty + protocols list. Ensure that we produce a user-visible error. + """ + context = Context(SSLv23_METHOD) + with pytest.raises(Error): + context.set_alpn_protos([]) + def test_alpn_set_on_connection(self): """ The same as test_alpn_success, but setting the ALPN protocols on |