コード例 #1
0
 def match(self,
           target,
           url,
           matcher_method='GET',
           request_method='GET',
           complete_qs=False,
           headers=None,
           request_data=None,
           request_headers={},
           additional_matcher=None,
           real_http=False,
           case_sensitive=False):
     matcher = adapter._Matcher(matcher_method,
                                target,
                                [],
                                complete_qs=complete_qs,
                                additional_matcher=additional_matcher,
                                request_headers=request_headers,
                                real_http=real_http,
                                case_sensitive=case_sensitive)
     request = adapter._RequestObjectProxy._create(request_method,
                                                   url,
                                                   headers,
                                                   data=request_data)
     return matcher._match(request)
コード例 #2
0
ファイル: test_matcher.py プロジェクト: Givemore/fjord
 def match(
     self,
     target,
     url,
     matcher_method="GET",
     request_method="GET",
     complete_qs=False,
     headers=None,
     request_headers={},
 ):
     matcher = adapter._Matcher(matcher_method, target, [], complete_qs, request_headers)
     request = adapter._RequestObjectProxy._create(request_method, url, headers)
     return matcher._match(request)
コード例 #3
0
 def match(self,
           target,
           url,
           matcher_method='GET',
           request_method='GET',
           complete_qs=False,
           headers=None,
           request_headers={}):
     matcher = adapter._Matcher(matcher_method, target, [], complete_qs,
                                request_headers)
     request = adapter._RequestObjectProxy._create(request_method, url,
                                                   headers)
     return matcher._match(request)
コード例 #4
0
    def test_reset_reverts_count(self):
        url = 'mock://test/site/'
        matcher = adapter._Matcher('GET',
                                   url, [_MatcherResponse()],
                                   complete_qs=False,
                                   additional_matcher=None,
                                   request_headers={},
                                   real_http=False,
                                   case_sensitive=False)
        request = adapter._RequestObjectProxy._create('GET', url)

        call_count = 3
        for _ in range(call_count):
            matcher(request)

        self.assertEqual(matcher.call_count, call_count)
        matcher.reset()
        self.assertEqual(matcher.call_count, 0)
コード例 #5
0
 def match(self,
           target,
           url,
           matcher_method='GET',
           request_method='GET',
           complete_qs=False,
           headers=None,
           request_headers={},
           real_http=False,
           case_sensitive=False):
     matcher = adapter._Matcher(matcher_method,
                                target, [],
                                complete_qs,
                                request_headers,
                                real_http=real_http,
                                case_sensitive=case_sensitive)
     request = adapter._RequestObjectProxy._create(request_method, url,
                                                   headers)
     return matcher._match(request)