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:
636636 """
637637 super ().__init__ ()
638638 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+ )
641650 date = email .utils .formatdate (None , localtime = False , usegmt = True )
642651 self .headers = {
643652 'Connection' : 'Close' ,
Original file line number Diff line number Diff line change 66import io
77from typing import Dict
88
9- import requests
109from PIL import Image
1110
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+ )
1316
1417
1518def validate_image_field_given (
Original file line number Diff line number Diff line change 6262 """ , # noqa: E501
6363)
6464
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+ )
6576
6677_JETTY_ERROR_DELETION_NOT_COMPLETE_START_PATH = (
6778 Path (__file__ ).parent / 'jetty_error_deletion_not_complete.html'
@@ -1296,6 +1307,7 @@ def test_png(
12961307 www_authenticate = None ,
12971308 connection = 'Close' ,
12981309 )
1310+ assert response .text == _NGINX_REQUEST_ENTITY_TOO_LARGE_ERROR
12991311
13001312 def test_jpeg (
13011313 self ,
@@ -1370,6 +1382,8 @@ def test_jpeg(
13701382 connection = 'Close' ,
13711383 )
13721384
1385+ assert response .text == _NGINX_REQUEST_ENTITY_TOO_LARGE_ERROR
1386+
13731387
13741388@pytest .mark .usefixtures ('verify_mock_vuforia' )
13751389class TestMaximumImageDimensions :
You can’t perform that action at this time.
0 commit comments