Created
November 15, 2017 14:45
-
-
Save leni1/c05f1d3568a1221e9723d727be49a393 to your computer and use it in GitHub Desktop.
This contains the sample code for test_image_validation.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_invalid_data_url(): | |
with screenshots_session() as user: | |
shot_id = make_random_id() + "/test.com" | |
shot_data = urljoin(user.backend, "data/" + shot_id) | |
shot_json = make_example_shot(user.deviceId) | |
invalid_data_url = "https://example.com/?aaA=bbb=\"); background-color: red;" | |
for clip_id in shot_json['clips']: | |
shot_json['clips'][clip_id]['image']['url'] = invalid_url | |
break | |
resp = user.session.put( | |
shot_data, | |
json=shot_json, | |
) | |
print(resp.text) | |
assert resp.status_code == 500 # assertion failure on data url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment