Skip to content

Commit 863a6f0

Browse files
committed
added & fixed test
1 parent 3ac937f commit 863a6f0

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tests/test_http_asgi.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,19 @@ def test_middleware_calls_app(self):
198198
test_body = b'Hello world!'
199199
app.response_body = test_body
200200
app.response_code = 200
201-
req = func.HttpRequest(method='get', url='/test', body=b'')
201+
req = self._generate_func_request()
202+
response = AsgiMiddleware(app).handle(req)
203+
204+
# Verify asserted
205+
self.assertEqual(response.status_code, 200)
206+
self.assertEqual(response.get_body(), test_body)
207+
208+
def test_middleware_calls_app_http(self):
209+
app = MockAsgiApplication()
210+
test_body = b'Hello world!'
211+
app.response_body = test_body
212+
app.response_code = 200
213+
req = self._generate_func_request(url="http://a.b.com")
202214
response = AsgiMiddleware(app).handle(req)
203215

204216
# Verify asserted

0 commit comments

Comments
 (0)