mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-16 01:44:51 +03:00
Fix linting for websocket tests
This commit is contained in:
parent
5381b482ef
commit
b04e5f2e1a
|
@ -105,8 +105,12 @@ def remove_async_files():
|
||||||
file_names = [
|
file_names = [
|
||||||
os.path.join("config", "asgi.py"),
|
os.path.join("config", "asgi.py"),
|
||||||
os.path.join("{{cookiecutter.project_slug}}", "users", "websocket.py"),
|
os.path.join("{{cookiecutter.project_slug}}", "users", "websocket.py"),
|
||||||
os.path.join("{{cookiecutter.project_slug}}", "users", "tests", "async_server.py"),
|
os.path.join(
|
||||||
os.path.join("{{cookiecutter.project_slug}}", "users", "tests", "test_socket.py"),
|
"{{cookiecutter.project_slug}}", "users", "tests", "async_server.py"
|
||||||
|
),
|
||||||
|
os.path.join(
|
||||||
|
"{{cookiecutter.project_slug}}", "users", "tests", "test_socket.py"
|
||||||
|
),
|
||||||
]
|
]
|
||||||
for file_name in file_names:
|
for file_name in file_names:
|
||||||
os.remove(file_name)
|
os.remove(file_name)
|
||||||
|
|
|
@ -4,15 +4,17 @@ https://github.com/encode/uvicorn/blob/master/tests/protocols/test_websocket.py
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from asyncio import new_event_loop
|
from asyncio import new_event_loop
|
||||||
|
|
||||||
from websockets import connect
|
from websockets import connect
|
||||||
|
|
||||||
from {{ cookiecutter.project_slug }}.users.tests.async_server import run_server
|
from {{cookiecutter.project_slug}}.users.tests.async_server import run_server
|
||||||
|
|
||||||
|
|
||||||
def test_accept_connection():
|
def test_accept_connection():
|
||||||
"""
|
"""
|
||||||
If you want to communicate over HTTP, add live_server fixture
|
If you want to communicate over HTTP, add live_server fixture
|
||||||
"""
|
"""
|
||||||
|
|
||||||
async def open_connection(url):
|
async def open_connection(url):
|
||||||
async with connect(url) as websocket:
|
async with connect(url) as websocket:
|
||||||
return websocket.open
|
return websocket.open
|
||||||
|
|
Loading…
Reference in New Issue
Block a user