示例#1
0
 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"}
示例#2
0
 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"}}
示例#3
0
 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
示例#4
0
 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'}}
示例#5
0
 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'}
示例#6
0
 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