diff --git a/e2e/app.py b/e2e/app.py index b1dc08964..12856635a 100644 --- a/e2e/app.py +++ b/e2e/app.py @@ -61,4 +61,4 @@ def catch_all(path): if __name__ == '__main__': - app.run(port='5000') + app.run(port=5000) diff --git a/pact/pact.py b/pact/pact.py index 847c8b14c..4c8cf9de5 100644 --- a/pact/pact.py +++ b/pact/pact.py @@ -299,7 +299,7 @@ def __init__(self, method, path, body=None, headers=None, query=''): :param method: The HTTP method that is expected. :type method: str :param path: The URI path that is expected on this request. - :type path: str + :type path: str, Matcher :param body: The contents of the body of the expected request. :type body: str, dict, list :param headers: The headers of the expected request. @@ -308,7 +308,7 @@ def __init__(self, method, path, body=None, headers=None, query=''): :type query: str or dict """ self.method = method - self.path = path + self.path = from_term(path) self.body = from_term(body) self.headers = from_term(headers) self.query = from_term(query) diff --git a/pact/test/test_pact.py b/pact/test/test_pact.py index b700d7a7d..5d27dc795 100644 --- a/pact/test/test_pact.py +++ b/pact/test/test_pact.py @@ -5,7 +5,7 @@ from mock import patch, call, Mock from psutil import Process -from .. import Consumer, Provider, pact +from .. import Consumer, Provider, Term, pact from ..constants import MOCK_SERVICE_PATH from ..pact import Pact, FromTerms, Request, Response @@ -476,6 +476,11 @@ def test_falsey_body(self): 'path': '/path', 'body': []}) + def test_matcher_in_path_gets_converted(self): + target = Request('GET', Term('\/.+', '/test-path')) + result = target.json() + self.assertTrue(isinstance(result['path'], dict)) + class ResponseTestCase(TestCase): def test_sparse(self):