This repository has been archived by the owner on Jan 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
) * Fix #3204, give proper response code for request entity too large * Fix #3204, give 400 Bad Request when id is invalid
- Loading branch information
1 parent
d12066c
commit 4d53220
Showing
3 changed files
with
69 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!../../.venv/bin/python | ||
|
||
from clientlib import ScreenshotsClient | ||
import random | ||
from requests import HTTPError | ||
|
||
# Hack to make this predictable: | ||
random.seed(0) | ||
|
||
|
||
def test_put_large_image(): | ||
user = ScreenshotsClient() | ||
user.login() | ||
try: | ||
try: | ||
user.create_shot(pad_image_to_length=100 * 1000 * 1000) | ||
except HTTPError, e: | ||
if e.response.status_code != 413: | ||
raise | ||
finally: | ||
user.delete_account() | ||
|
||
|
||
def test_bad_id(): | ||
user = ScreenshotsClient() | ||
user.login() | ||
try: | ||
try: | ||
user.create_shot(shot_id="!!!/test.com") | ||
except HTTPError, e: | ||
if e.response.status_code != 400: | ||
raise | ||
finally: | ||
user.delete_account() | ||
|
||
|
||
if __name__ == "__main__": | ||
test_put_large_image() | ||
test_bad_id() |