blob: e4b734607e055aa13cbe4afddc6772115336c0ad [file] [log] [blame]
Alex Gaynorbfc06bc2013-08-06 19:36:19 -07001# Licensed under the Apache License, Version 2.0 (the "License");
2# you may not use this file except in compliance with the License.
3# You may obtain a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS,
9# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10# implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
Paul Kehrerfe9b82d2013-09-09 22:09:21 -050014import pytest
15
Hynek Schlawack196515a2013-08-08 08:40:47 +020016from cryptography.bindings.openssl import api
Alex Gaynorc62e91f2013-08-06 19:25:52 -070017
18
Hynek Schlawack196515a2013-08-08 08:40:47 +020019class TestOpenSSL(object):
20 def test_api_exists(self):
21 assert api
Paul Kehrer733404a2013-09-09 15:26:26 -050022
23 def test_openssl_version_text(self):
Paul Kehrerc1a218d2013-09-09 17:45:52 -050024 """
25 This test checks the value of OPENSSL_VERSION_TEXT.
Paul Kehrereb49db12013-09-09 17:12:29 -050026
27 Unfortunately, this define does not appear to have a
28 formal content definition, so for now we'll test to see
29 if it starts with OpenSSL as that appears to be true
30 for every OpenSSL.
31 """
Paul Kehrerbdafcd32013-09-09 17:44:11 -050032 assert api.openssl_version_text().startswith("OpenSSL")
Paul Kehrerfe9b82d2013-09-09 22:09:21 -050033
34 def test_get_iv_invalid_mode(self):
35 with pytest.raises(NotImplementedError):
36 api._get_iv(None)