Exemplo n.º 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"}
Exemplo n.º 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"}}
Exemplo n.º 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
Exemplo n.º 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'}}
Exemplo n.º 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'}
Exemplo n.º 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