예제 #1
0
 def digest_parts(self, headers):
     auth = headers.get('Authorization') or headers.get('authorization')
     if not auth:
         return None
     auth = from_list(auth).strip('Digest ')
     # cnonce and response will be based on the system time, which I will
     # not monkey-patch.
     excludes = ('cnonce', 'response')
     return [p for p in auth.split(', ') if not p.startswith(excludes)]
예제 #2
0
 def digest_parts(self, headers):
     auth = headers.get('Authorization') or headers.get('authorization')
     if not auth:
         return None
     auth = from_list(auth).strip('Digest ')
     # cnonce and response will be based on the system time, which I will
     # not monkey-patch.
     excludes = ('cnonce', 'response')
     return [p for p in auth.split(', ') if not p.startswith(excludes)]
예제 #3
0
 def test_from_list_handles_non_lists(self):
     a = 'value'
     assert util.from_list(a) == 'value'
예제 #4
0
 def test_from_list_returns_an_element(self):
     a = ['value']
     assert util.from_list(a) == 'value'
예제 #5
0
 def replace_in_headers(self, text_to_replace, placeholder):
     for obj in ('request', 'response'):
         headers = self.json[obj]['headers']
         for k, v in list(headers.items()):
             v = util.from_list(v)
             headers[k] = v.replace(text_to_replace, placeholder)
예제 #6
0
 def replace_in_headers(self, text_to_replace, placeholder):
     for obj in ('request', 'response'):
         headers = self.json[obj]['headers']
         for k, v in list(headers.items()):
             v = util.from_list(v)
             headers[k] = v.replace(text_to_replace, placeholder)
예제 #7
0
 def test_from_list_handles_non_lists(self):
     a = 'value'
     assert util.from_list(a) == 'value'
예제 #8
0
 def test_from_list_returns_an_element(self):
     a = ['value']
     assert util.from_list(a) == 'value'
예제 #9
0
 def flatten_headers(self, request):
     from betamax.util import from_list
     headers = request['headers'].items()
     return dict((k, from_list(v)) for (k, v) in headers)