diff --git a/tests/unit/test_matchers.py b/tests/unit/test_matchers.py index f06db11..d6e4123 100644 --- a/tests/unit/test_matchers.py +++ b/tests/unit/test_matchers.py @@ -38,5 +38,5 @@ def test_url_matcher(): def test_metchers(): assert_matcher('method') assert_matcher('host') - #assert_matcher('method') + assert_matcher('port') #assert_matcher('method') diff --git a/vcr/matchers.py b/vcr/matchers.py index 0adf3a8..1bdc515 100644 --- a/vcr/matchers.py +++ b/vcr/matchers.py @@ -13,6 +13,10 @@ def host(r1, r2): return r1.host == r2.host +def port(r1, r2): + return r1.port == r2.port + + def path(r1, r2): return r1.path == r2.path diff --git a/vcr/request.py b/vcr/request.py index 7debabf..8b45a47 100644 --- a/vcr/request.py +++ b/vcr/request.py @@ -19,6 +19,10 @@ class Request(object): def host(self): return urlparse(self.uri).hostname + @property + def port(self): + return urlparse(self.uri).port + @property def url(self): return self.uri