Пример #1
0
 def test_safer_headers_are_untouched(self):
     """Safer headers are passed without modification."""
     safe_headers = {"Accept": "*/*"}
     event = {
         "request": {
             "url": "https://example.com",
             "headers": deepcopy(safe_headers)
         }
     }
     SanitizeHeaders(["Auth-Token"])(event, {})
     assert event["request"]["headers"] == safe_headers
Пример #2
0
 def test_no_headers(self):
     """An event without headers is unmodified."""
     event = {"request": {"url": "https://example.com"}}
     SanitizeHeaders(["Auth-Token"])(event, {})
     assert event == {"request": {"url": "https://example.com"}}
Пример #3
0
 def test_filtered_headers(self, names, url, headers, expected):
     """Sensitive Headers are filtered."""
     event = {"request": {"url": url, "headers": deepcopy(headers)}}
     SanitizeHeaders(names.split(","))(event, {})
     assert event["request"]["headers"] == expected
Пример #4
0
 def test_no_headers(self):
     """An event without headers is unmodified."""
     event = {'request': {'url': 'https://example.com'}}
     SanitizeHeaders(['Auth-Token'])(event, {})
     assert event == {'request': {'url': 'https://example.com'}}
Пример #5
0
 def test_safer_headers_are_untouched(self):
     """Safer headers are passed without modification."""
     safe_headers = {'Accept': '*/*'}
     event = {'request': {'url': 'https://example.com', 'headers': deepcopy(safe_headers)}}
     SanitizeHeaders(['Auth-Token'])(event, {})
     assert event['request']['headers'] == safe_headers
Пример #6
0
 def test_filtered_headers(self, names, url, headers, expected):
     """Sensitive Headers are filtered."""
     event = {'request': {'url': url, 'headers': deepcopy(headers)}}
     SanitizeHeaders(names.split(','))(event, {})
     assert event['request']['headers'] == expected