From 8c1f5edd12d755c770d1fd3a6dc8251c95588600 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Wed, 13 Sep 2017 22:06:12 +0800 Subject: fix a bug with URI value when parsing a string with no hostname (#3909) strings of the form "scheme:///anything" would incorrectly have two slashes dropped. This is fixed in two code paths in this PR but one of those code paths will be entirely removed in a followup PR. --- tests/x509/test_x509_ext.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/x509/test_x509_ext.py b/tests/x509/test_x509_ext.py index b3ea1f96..929a9380 100644 --- a/tests/x509/test_x509_ext.py +++ b/tests/x509/test_x509_ext.py @@ -1689,10 +1689,11 @@ class TestUniformResourceIdentifier(object): b"gopher://xn--80ato2c.cryptography:70/some/path" ) - def test_empty_string(self): - gn = x509.UniformResourceIdentifier(b"") + def test_empty_hostname(self): + gn = x509.UniformResourceIdentifier(b"ldap:///some-nonsense") + assert gn.bytes_value == b"ldap:///some-nonsense" with pytest.warns(utils.DeprecatedIn21): - assert gn.value == u"" + assert gn.value == "ldap:///some-nonsense" def test_query_and_fragment(self): gn = x509.UniformResourceIdentifier( @@ -3819,7 +3820,7 @@ class TestCRLDistributionPointsExtension(object): assert cdps == x509.CRLDistributionPoints([ x509.DistributionPoint( full_name=[x509.UniformResourceIdentifier( - u"ldap:/CN=A,OU=B,dc=C,DC=D?E?F?G?H=I" + b"ldap:///CN=A,OU=B,dc=C,DC=D?E?F?G?H=I" )], relative_name=None, reasons=None, -- cgit v1.2.3