Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Add test for invalid data image decoded
Browse files Browse the repository at this point in the history
Added the test for invalid data image decoded.
  • Loading branch information
leni1 committed May 3, 2018
1 parent b275b06 commit 41bc89f
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions test/server/test_image_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
example_images
)
import random
# import string

# Hack to make this predictable:
random.seed(0)
Expand Down Expand Up @@ -53,7 +52,24 @@ def test_invalid_data_image():


def test_invalid_data_image_decoded():
pass
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)
for image in example_images:
valid_data_image = image['url']
if "iVBORw0KGgo" in valid_data_image:
invalid_data_image = valid_data_image.replace('iVBORw0KGgo', 'someIM4gEgo')
for clip_id in shot_json['clips']:
shot_json['clips'][clip_id]['image'] = invalid_data_image
break

resp = user.session.put(
shot_data,
json=shot_json,
)
print(resp.text)
assert resp.status_code == 500


def test_invalid_data_url():
Expand Down

0 comments on commit 41bc89f

Please sign in to comment.