Merge pull request #1562 from huge-success/testing-client
Testing client
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import asyncio
|
||||
import inspect
|
||||
import os
|
||||
|
||||
from collections import namedtuple
|
||||
from mimetypes import guess_type
|
||||
from random import choice
|
||||
@@ -8,6 +9,7 @@ from unittest.mock import MagicMock
|
||||
from urllib.parse import unquote
|
||||
|
||||
import pytest
|
||||
|
||||
from aiofiles import os as async_os
|
||||
|
||||
from sanic.response import (
|
||||
@@ -18,11 +20,11 @@ from sanic.response import (
|
||||
json,
|
||||
raw,
|
||||
stream,
|
||||
text,
|
||||
)
|
||||
from sanic.server import HttpProtocol
|
||||
from sanic.testing import HOST, PORT
|
||||
|
||||
|
||||
JSON_DATA = {"ok": True}
|
||||
|
||||
|
||||
@@ -77,10 +79,10 @@ def test_response_header(app):
|
||||
|
||||
request, response = app.test_client.get("/")
|
||||
assert dict(response.headers) == {
|
||||
"Connection": "keep-alive",
|
||||
"Keep-Alive": str(app.config.KEEP_ALIVE_TIMEOUT),
|
||||
"Content-Length": "11",
|
||||
"Content-Type": "application/json",
|
||||
"connection": "keep-alive",
|
||||
"keep-alive": str(app.config.KEEP_ALIVE_TIMEOUT),
|
||||
"content-length": "11",
|
||||
"content-type": "application/json",
|
||||
}
|
||||
|
||||
|
||||
@@ -363,7 +365,7 @@ def test_stream_response_with_cookies(app):
|
||||
return response
|
||||
|
||||
request, response = app.test_client.get("/")
|
||||
assert response.cookies["test"].value == "pass"
|
||||
assert response.cookies["test"] == "pass"
|
||||
|
||||
|
||||
def test_stream_response_without_cookies(app):
|
||||
|
||||
Reference in New Issue
Block a user