]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
Added port to Request with matcher and test
authorMax Shytikov <mshytikov@gmail.com>
Sun, 6 Apr 2014 23:12:05 +0000 (01:12 +0200)
committerMax Shytikov <mshytikov@gmail.com>
Wed, 30 Apr 2014 00:27:52 +0000 (02:27 +0200)
tests/unit/test_matchers.py
vcr/matchers.py
vcr/request.py

index f06db11f30927a3b10d0501711c4c27c15265519..d6e412383edaf9e5df4d8ea9aa474e89e1a5719e 100644 (file)
@@ -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')
index 0adf3a84ec830e92ab8c988ca70cdb076908d22d..1bdc5153760b036fcda32779c4d80ed69c554b88 100644 (file)
@@ -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
 
index 7debabf620608d121f7febf061cc4983b150b049..8b45a47fa1d12b2df1965e59e9ab93221587c9e4 100644 (file)
@@ -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