squash
This commit is contained in:
@@ -4,6 +4,8 @@ import asyncio
|
||||
def test_bad_request_response(app):
|
||||
lines = []
|
||||
|
||||
app.get("/")(lambda x: ...)
|
||||
|
||||
@app.listener("after_server_start")
|
||||
async def _request(sanic, loop):
|
||||
connect = asyncio.open_connection("127.0.0.1", 42101)
|
||||
|
||||
@@ -2,7 +2,13 @@
|
||||
|
||||
# import pytest
|
||||
|
||||
# from sanic_testing.testing import SanicTestClient
|
||||
from sanic_testing.testing import SanicTestClient
|
||||
|
||||
from sanic import Sanic
|
||||
from sanic.constants import HTTP_METHODS
|
||||
from sanic.response import json, text
|
||||
from sanic.router import ParameterNameConflicts, RouteDoesNotExist, RouteExists
|
||||
|
||||
|
||||
# from sanic import Sanic
|
||||
# from sanic.constants import HTTP_METHODS
|
||||
@@ -475,24 +481,23 @@
|
||||
# def test_websocket_route_with_subprotocols(app):
|
||||
# results = []
|
||||
|
||||
# @app.websocket("/ws", subprotocols=["foo", "bar"])
|
||||
# async def handler(request, ws):
|
||||
# results.append(ws.subprotocol)
|
||||
# assert ws.subprotocol is not None
|
||||
# _, response = SanicTestClient(app).websocket("/ws", subprotocols=["bar"])
|
||||
# assert response.opened is True
|
||||
# assert results == ["bar"]
|
||||
|
||||
# _, response = SanicTestClient(app).websocket("/ws", subprotocols=["bar"])
|
||||
# assert response.opened is True
|
||||
# assert results == ["bar"]
|
||||
# _, response = SanicTestClient(app).websocket(
|
||||
# "/ws", subprotocols=["bar", "foo"]
|
||||
# )
|
||||
# assert response.opened is True
|
||||
# assert results == ["bar", "bar"]
|
||||
|
||||
# _, response = SanicTestClient(app).websocket(
|
||||
# "/ws", subprotocols=["bar", "foo"]
|
||||
# )
|
||||
# assert response.opened is True
|
||||
# assert results == ["bar", "bar"]
|
||||
# _, response = SanicTestClient(app).websocket("/ws", subprotocols=["baz"])
|
||||
# assert response.opened is True
|
||||
# assert results == ["bar", "bar", None]
|
||||
|
||||
# _, response = SanicTestClient(app).websocket("/ws", subprotocols=["baz"])
|
||||
# assert response.opened is True
|
||||
# assert results == ["bar", "bar", None]
|
||||
# _, response = SanicTestClient(app).websocket("/ws")
|
||||
# assert response.opened is True
|
||||
# assert results == ["bar", "bar", None, None]
|
||||
|
||||
# _, response = SanicTestClient(app).websocket("/ws")
|
||||
# assert response.opened is True
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import inspect
|
||||
import os
|
||||
|
||||
from pathlib import Path
|
||||
from time import gmtime, strftime
|
||||
|
||||
@@ -93,8 +94,8 @@ def test_static_file_pathlib(app, static_file_directory, file_name):
|
||||
[b"test.file", b"decode me.txt", b"python.png"],
|
||||
)
|
||||
def test_static_file_bytes(app, static_file_directory, file_name):
|
||||
bsep = os.path.sep.encode('utf-8')
|
||||
file_path = static_file_directory.encode('utf-8') + bsep + file_name
|
||||
bsep = os.path.sep.encode("utf-8")
|
||||
file_path = static_file_directory.encode("utf-8") + bsep + file_name
|
||||
app.static("/testing.file", file_path)
|
||||
request, response = app.test_client.get("/testing.file")
|
||||
assert response.status == 200
|
||||
|
||||
Reference in New Issue
Block a user