From 2d1d3bbc49ab3a15069591fac36f8fd59f424233 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Thu, 13 Mar 2014 13:46:10 -0400 Subject: make create_modulename private, add test --- tests/hazmat/bindings/test_utils.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/hazmat/bindings/test_utils.py (limited to 'tests/hazmat/bindings/test_utils.py') diff --git a/tests/hazmat/bindings/test_utils.py b/tests/hazmat/bindings/test_utils.py new file mode 100644 index 00000000..d458972e --- /dev/null +++ b/tests/hazmat/bindings/test_utils.py @@ -0,0 +1,28 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import, division, print_function + +import sys + +import pretend + +from cryptography.hazmat.bindings import utils + + +def test_create_modulename(): + pretend_ffi = pretend.stub(_cdefsources=["cdef sources go here"]) + source = "source code" + name = utils._create_modulename(pretend_ffi, source, sys.version, + sys.version_info) + assert name == "_cffi_bcba7f4bx4a14b588" -- cgit v1.2.3 From 738707729b64ead86ebf71ba6a87a5c1d690b309 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Thu, 13 Mar 2014 14:11:04 -0400 Subject: be less dumb --- tests/hazmat/bindings/test_utils.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tests/hazmat/bindings/test_utils.py') diff --git a/tests/hazmat/bindings/test_utils.py b/tests/hazmat/bindings/test_utils.py index d458972e..2ba391ec 100644 --- a/tests/hazmat/bindings/test_utils.py +++ b/tests/hazmat/bindings/test_utils.py @@ -13,8 +13,6 @@ from __future__ import absolute_import, division, print_function -import sys - import pretend from cryptography.hazmat.bindings import utils @@ -23,6 +21,7 @@ from cryptography.hazmat.bindings import utils def test_create_modulename(): pretend_ffi = pretend.stub(_cdefsources=["cdef sources go here"]) source = "source code" - name = utils._create_modulename(pretend_ffi, source, sys.version, - sys.version_info) + name = utils._create_modulename(pretend_ffi, source, "2.7") assert name == "_cffi_bcba7f4bx4a14b588" + name = utils._create_modulename(pretend_ffi, source, "3.2") + assert name == "_cffi_a7462526x4a14b588" -- cgit v1.2.3 From 5b143b42ae4ebcb43cd1a52d361dd0e2e46ca2d6 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Mon, 17 Mar 2014 17:58:42 -0400 Subject: should probably update the test too --- tests/hazmat/bindings/test_utils.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'tests/hazmat/bindings/test_utils.py') diff --git a/tests/hazmat/bindings/test_utils.py b/tests/hazmat/bindings/test_utils.py index 2ba391ec..0d5b34de 100644 --- a/tests/hazmat/bindings/test_utils.py +++ b/tests/hazmat/bindings/test_utils.py @@ -13,15 +13,13 @@ from __future__ import absolute_import, division, print_function -import pretend - from cryptography.hazmat.bindings import utils def test_create_modulename(): - pretend_ffi = pretend.stub(_cdefsources=["cdef sources go here"]) + cdef_sources = ["cdef sources go here"] source = "source code" - name = utils._create_modulename(pretend_ffi, source, "2.7") - assert name == "_cffi_bcba7f4bx4a14b588" - name = utils._create_modulename(pretend_ffi, source, "3.2") - assert name == "_cffi_a7462526x4a14b588" + name = utils._create_modulename(cdef_sources, source, "2.7") + assert name == "_Cryptography_cffi_bcba7f4bx4a14b588" + name = utils._create_modulename(cdef_sources, source, "3.2") + assert name == "_Cryptography_cffi_a7462526x4a14b588" -- cgit v1.2.3