diff options
| author | Gabriel Falcão <gabriel@nacaolivre.org> | 2013-09-29 20:54:49 -0700 |
|---|---|---|
| committer | Gabriel Falcão <gabriel@nacaolivre.org> | 2013-09-29 20:54:49 -0700 |
| commit | 3413b51326b7683a490ff09d5d7889839b29158f (patch) | |
| tree | 229b7a9c378bce3e7fcf1ff8a64da95ce9511ae9 | |
| parent | 3971b71334bc3e27d5a267d387395622e4e66927 (diff) | |
| parent | a63f3a675085a487caa76ff8905346b3d8d1449b (diff) | |
| download | httpretty-3413b51326b7683a490ff09d5d7889839b29158f.tar.gz | |
Merge pull request #95 from mikewaters/master
Use common string case for URIInfo hostname comparison.
| -rw-r--r-- | httpretty/core.py | 4 | ||||
| -rw-r--r-- | tests/unit/test_httpretty.py | 26 |
2 files changed, 27 insertions, 3 deletions
diff --git a/httpretty/core.py b/httpretty/core.py index 107d638..6f4e72f 100644 --- a/httpretty/core.py +++ b/httpretty/core.py @@ -555,12 +555,12 @@ class URIInfo(BaseClass): def __eq__(self, other): self_tuple = ( self.port, - decode_utf8(self.hostname), + decode_utf8(self.hostname.lower()), url_fix(decode_utf8(self.path)), ) other_tuple = ( other.port, - decode_utf8(other.hostname), + decode_utf8(other.hostname.lower()), url_fix(decode_utf8(other.path)), ) return self_tuple == other_tuple diff --git a/tests/unit/test_httpretty.py b/tests/unit/test_httpretty.py index 525df6e..bc0c913 100644 --- a/tests/unit/test_httpretty.py +++ b/tests/unit/test_httpretty.py @@ -184,7 +184,6 @@ def test_status_codes(): 599: "Network connect timeout error", }) - def test_uri_info_full_url(): uri_info = URIInfo( username='johhny', @@ -205,6 +204,31 @@ def test_uri_info_full_url(): "http://johhny:password@google.com/" ) +def test_uri_info_eq_ignores_case(): + """Test that URIInfo.__eq__ method ignores case for + hostname matching. + """ + uri_info_uppercase = URIInfo( + username='johhny', + password='password', + hostname=b'GOOGLE.COM', + port=80, + path=b'/', + query=b'foo=bar&baz=test', + fragment='', + scheme='', + ) + uri_info_lowercase = URIInfo( + username='johhny', + password='password', + hostname=b'google.com', + port=80, + path=b'/', + query=b'foo=bar&baz=test', + fragment='', + scheme='', + ) + expect(uri_info_uppercase).to.equal(uri_info_lowercase) def test_global_boolean_enabled(): expect(HTTPretty.is_enabled()).to.be.falsy |
