Skip to content

Instantly share code, notes, and snippets.

@leni1
Created November 15, 2017 14:45
Show Gist options
  • Save leni1/c05f1d3568a1221e9723d727be49a393 to your computer and use it in GitHub Desktop.
Save leni1/c05f1d3568a1221e9723d727be49a393 to your computer and use it in GitHub Desktop.
This contains the sample code for test_image_validation.py
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