diff options
-rwxr-xr-x | .travis/install.sh | 5 | ||||
-rw-r--r-- | src/cryptography/x509/general_name.py | 3 | ||||
-rw-r--r-- | tests/test_x509_ext.py | 8 |
3 files changed, 16 insertions, 0 deletions
diff --git a/.travis/install.sh b/.travis/install.sh index 0d654253..5e8c11cc 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -75,6 +75,11 @@ else tar zxf openssl-$OPENSSL_VERSION_NUMBER.tar.gz cd openssl-$OPENSSL_VERSION_NUMBER ./config shared no-asm no-ssl2 -fPIC --prefix="$HOME/$OPENSSL_DIR" + # modify the shlib version to a unique one to make sure the dynamic linker + # doesn't load the system one. + sed -i "s/^SHLIB_MAJOR=.*/SHLIB_MAJOR=100/" Makefile + sed -i "s/^SHLIB_MINOR=.*/SHLIB_MINOR=0.0/" Makefile + sed -i "s/^SHLIB_VERSION_NUMBER=.*/SHLIB_VERSION_NUMBER=100.0.0/" Makefile make depend make install fi diff --git a/src/cryptography/x509/general_name.py b/src/cryptography/x509/general_name.py index 3e0562af..6745243a 100644 --- a/src/cryptography/x509/general_name.py +++ b/src/cryptography/x509/general_name.py @@ -158,6 +158,9 @@ class UniformResourceIdentifier(object): def __ne__(self, other): return not self == other + def __hash__(self): + return hash(self.value) + @utils.register_interface(GeneralName) class DirectoryName(object): diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py index 450f192d..9ac1d2ba 100644 --- a/tests/test_x509_ext.py +++ b/tests/test_x509_ext.py @@ -1488,6 +1488,14 @@ class TestUniformResourceIdentifier(object): ) assert gn.value == u"ldap://cryptography:90/path?query=true#somedata" + def test_hash(self): + g1 = x509.UniformResourceIdentifier(u"http://host.com") + g2 = x509.UniformResourceIdentifier(u"http://host.com") + g3 = x509.UniformResourceIdentifier(u"http://other.com") + + assert hash(g1) == hash(g2) + assert hash(g1) != hash(g3) + class TestRegisteredID(object): def test_not_oid(self): |