Пример #1
0
def test_partial_path_match():
    assert partial_path_match('/v1/bing/forward_unstructured',
                              '/v1/bing/forward_unstructured')
    assert partial_path_match('/v1/{api_provider}/forward_unstructured',
                              '/v1/bing/forward_unstructured')
    assert not partial_path_match('/v1/google/forward_unstructured',
                                  '/v1/bing/forward_unstructured')
Пример #2
0
def test_partial_path_match():
    assert partial_path_match(
        '/v1/bing/forward_unstructured',
        '/v1/bing/forward_unstructured'
    )
    assert partial_path_match(
        '/v1/{api_provider}/forward_unstructured',
        '/v1/bing/forward_unstructured'
    )
    assert not partial_path_match(
        '/v1/google/forward_unstructured',
        '/v1/bing/forward_unstructured'
    )
Пример #3
0
 def matches(self, request):
     """
     :param request: a :class:`pyramid.request.Request`
     :returns: True if this matcher matches the request, False otherwise
     """
     return partial_path_match(request.path_info,
                               self.path) and request.method == self.method
Пример #4
0
 def matches(self, request):
     """
     :param request: a :class:`pyramid.request.Request`
     :returns: True if this matcher matches the request, False otherwise
     """
     return (
         partial_path_match(request.path_info, self.path) and
         request.method == self.method
     )