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
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"}}
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
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'}}
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
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