예제 #1
0
 def doMatcher(self):
     stub = self.context['stub']
     matchers = []
     for matcher in stub.contains_matchers():
         matchers.append(strip_namespace(matcher))
     stub.set_contains_matchers(matchers)
     return ExitResponse(self.request, stub)
예제 #2
0
 def doMatcher(self):
     stub = self.context['stub']
     matchers = []
     for matcher in stub.contains_matchers():
         # Note: there is only one matcher in this example
         matchers.append(self.substitute_request_values(matcher))
     stub.set_contains_matchers(matchers)
     return ExitResponse(self.request, stub)
예제 #3
0
 def doMatcher(self):
     stub = self.context['stub']
     if self.mangler:
         matchers = []
         for matcher in stub.contains_matchers():
             # use generic values during put/stub
             matchers.append(self.mangler.store(matcher))
         stub.set_contains_matchers(matchers)
     return ExitResponse(self.request, stub)
예제 #4
0
 def doMatcher(self):
     stub = self.context['stub']
     if self.mangler:
         matchers = []
         for matcher in stub.contains_matchers():
             # replace stub matcher wildcards transformed during the put/stub
             # with values extracted from the request so the values will match
             matchers.append(self.substitute_values(matcher, excludes=[]))
         stub.set_contains_matchers(matchers)
     return ExitResponse(self.request, stub)
예제 #5
0
 def doMatcherRequest(self):
     request = self.request
     if self.mangler:
         if self.mangler.extractor_names():
             request_body = self.substitute_values(request.request_body(),
                                                   excludes=[])
         else:
             request_body = strip_namespace(request.request_body())
         request.set_request_body_unicode(request_body)
     return ExitResponse(request, self.context['stub'])
예제 #6
0
 def doResponse(self):
     stub = self.context['stub']
     response = self.response_mangler.store(stub.response_body()[0])
     stub.set_response_body(response)
     return ExitResponse(self.request, stub)
예제 #7
0
 def doResponse(self):
     stub = self.context['stub']
     response = self.substitute_request_values(stub.response_body()[0])
     stub.set_response_body(response)
     return ExitResponse(self.request, stub)
예제 #8
0
 def doMatcherRequest(self):
     request = self.request
     request.set_request_body_unicode(
         strip_namespace(self.request.request_body()))
     return ExitResponse(request, self.context['stub'])
예제 #9
0
 def doResponse(self):
     stub = self.context['stub']
     stub.set_response_body('<response>{0}</response>'.format(self.inc()))
     return ExitResponse(self.request, stub)
예제 #10
0
 def doMatcher(self):
     stub = self.context['stub']
     matcher = stub.contains_matchers()[0]
     parts = matcher.partition('<id>xxx</id>')
     stub.set_contains_matchers([parts[0], parts[-1]])
     return ExitResponse(self.request, stub)