def test_construct_invalid_service_pattern(): ''' Should raise ValueError when pattern is missing ''' endpoint = {"scheme": "scheme", "host": "host", "port": "port"} with pytest.raises(ValueError): common.construct_service_pattern(endpoint)
def test_construct_invalid_service_pattern(): ''' Should raise ValueError when pattern is missing ''' endpoint = { "scheme": "scheme", "host": "host", "port": "port" } with pytest.raises(ValueError): common.construct_service_pattern(endpoint)
def test_construct_service_pattern(): ''' Should create a regex that can be used to dispatch operations ''' endpoint = { "scheme": "scheme", "host": "host", "port": "port", "pattern": "/api/{operation}/suffix" } common.construct_service_pattern(endpoint) match = endpoint["service_pattern"].match("/api/foo/suffix") assert match assert match.groupdict()["operation"] == "foo"