def test_safer_post_data_are_untouched(self): """Safer POST data are passed without modification.""" event = { "request": { "url": "https://example.com", "data": { "kittens": "fluffy" } } } SanitizePostData(names=["secret"])(event, {}) assert event["request"]["data"] == {"kittens": "fluffy"}
def test_no_post_data(self): """An event without POST data is unmodified.""" event = {"request": {"url": "https://example.com"}} SanitizePostData(names=["secret"])(event, {}) assert event == {"request": {"url": "https://example.com"}}
def test_filtered_post_data(self, names, url, post_data, expected): """Sensitive POST data are filtered.""" event = {"request": {"url": url, "data": deepcopy(post_data)}} SanitizePostData(names=names.split(","))(event, {}) assert event["request"]["data"] == expected
def test_no_post_data(self): """An event without POST data is unmodified.""" event = {'request': {'url': 'https://example.com'}} SanitizePostData(names=['secret'])(event, {}) assert event == {'request': {'url': 'https://example.com'}}
def test_safer_post_data_are_untouched(self): """Safer POST data are passed without modification.""" event = {'request': {'url': 'https://example.com', 'data': {'kittens': 'fluffy'}}} SanitizePostData(names=['secret'])(event, {}) assert event['request']['data'] == {'kittens': 'fluffy'}
def test_filtered_post_data(self, names, url, post_data, expected): """Sensitive POST data are filtered.""" event = {'request': {'url': url, 'data': deepcopy(post_data)}} SanitizePostData(names=names.split(','))(event, {}) assert event['request']['data'] == expected