File tree Expand file tree Collapse file tree 3 files changed +30
-4
lines changed
src/mock_vws/_query_validators Expand file tree Collapse file tree 3 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -636,8 +636,17 @@ def __init__(self) -> None:
636
636
"""
637
637
super ().__init__ ()
638
638
self .status_code = HTTPStatus .REQUEST_ENTITY_TOO_LARGE
639
- # TODO assert this!
640
- self .response_text = ''
639
+ self .response_text = textwrap .dedent (
640
+ """\
641
+ <html>\r
642
+ <head><title>413 Request Entity Too Large</title></head>\r
643
+ <body bgcolor="white">\r
644
+ <center><h1>413 Request Entity Too Large</h1></center>\r
645
+ <hr><center>nginx</center>\r
646
+ </body>\r
647
+ </html>\r
648
+ """ ,
649
+ )
641
650
date = email .utils .formatdate (None , localtime = False , usegmt = True )
642
651
self .headers = {
643
652
'Connection' : 'Close' ,
Original file line number Diff line number Diff line change 6
6
import io
7
7
from typing import Dict
8
8
9
- import requests
10
9
from PIL import Image
11
10
12
- from mock_vws ._query_validators .exceptions import BadImage , ImageNotGiven , RequestEntityTooLarge
11
+ from mock_vws ._query_validators .exceptions import (
12
+ BadImage ,
13
+ ImageNotGiven ,
14
+ RequestEntityTooLarge ,
15
+ )
13
16
14
17
15
18
def validate_image_field_given (
Original file line number Diff line number Diff line change 62
62
""" , # noqa: E501
63
63
)
64
64
65
+ _NGINX_REQUEST_ENTITY_TOO_LARGE_ERROR = textwrap .dedent (
66
+ """\
67
+ <html>\r
68
+ <head><title>413 Request Entity Too Large</title></head>\r
69
+ <body bgcolor="white">\r
70
+ <center><h1>413 Request Entity Too Large</h1></center>\r
71
+ <hr><center>nginx</center>\r
72
+ </body>\r
73
+ </html>\r
74
+ """ ,
75
+ )
65
76
66
77
_JETTY_ERROR_DELETION_NOT_COMPLETE_START_PATH = (
67
78
Path (__file__ ).parent / 'jetty_error_deletion_not_complete.html'
@@ -1296,6 +1307,7 @@ def test_png(
1296
1307
www_authenticate = None ,
1297
1308
connection = 'Close' ,
1298
1309
)
1310
+ assert response .text == _NGINX_REQUEST_ENTITY_TOO_LARGE_ERROR
1299
1311
1300
1312
def test_jpeg (
1301
1313
self ,
@@ -1370,6 +1382,8 @@ def test_jpeg(
1370
1382
connection = 'Close' ,
1371
1383
)
1372
1384
1385
+ assert response .text == _NGINX_REQUEST_ENTITY_TOO_LARGE_ERROR
1386
+
1373
1387
1374
1388
@pytest .mark .usefixtures ('verify_mock_vuforia' )
1375
1389
class TestMaximumImageDimensions :
You can’t perform that action at this time.
0 commit comments