Final notes [2]
This commit is contained in:
parent
0756aab53f
commit
8b58bf4db3
|
|
@ -19,7 +19,7 @@ from cmd_chat.server.routes import register_routes
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def app():
|
def app():
|
||||||
name = f"test-{uuid.uuid4().hex[:8]}"
|
name = f"test-{uuid.uuid4().hex[:8]}"
|
||||||
|
|
||||||
app = Sanic(name)
|
app = Sanic(name)
|
||||||
Extend(app)
|
Extend(app)
|
||||||
|
|
||||||
|
|
@ -32,10 +32,10 @@ def app():
|
||||||
|
|
||||||
register_routes(app)
|
register_routes(app)
|
||||||
TestManager(app)
|
TestManager(app)
|
||||||
|
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def test_client(app):
|
def test_client(app):
|
||||||
return app.test_client
|
return app.test_client
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TestHealth:
|
class TestHealth:
|
||||||
|
|
||||||
def test_health_ok(self, test_client):
|
def test_health_ok(self, test_client):
|
||||||
|
|
@ -11,4 +8,4 @@ class TestHealth:
|
||||||
assert data["status"] == "ok"
|
assert data["status"] == "ok"
|
||||||
assert "messages" in data
|
assert "messages" in data
|
||||||
assert "users" in data
|
assert "users" in data
|
||||||
assert "timestamp" in data
|
assert "timestamp" in data
|
||||||
|
|
|
||||||
|
|
@ -38,4 +38,4 @@ class TestSRPFlow:
|
||||||
"M": base64.b64encode(b"fake").decode(),
|
"M": base64.b64encode(b"fake").decode(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
assert response.status == 401
|
assert response.status == 401
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
class TestWebSocket:
|
class TestWebSocket:
|
||||||
|
|
||||||
def test_ws_connect_no_user_id(self, test_client):
|
def test_ws_connect_no_user_id(self, test_client):
|
||||||
|
|
@ -9,4 +7,4 @@ class TestWebSocket:
|
||||||
def test_ws_connect_invalid_session(self, test_client):
|
def test_ws_connect_invalid_session(self, test_client):
|
||||||
|
|
||||||
_, ws = test_client.websocket("/ws/chat?user_id=invalid123")
|
_, ws = test_client.websocket("/ws/chat?user_id=invalid123")
|
||||||
assert ws is not None
|
assert ws is not None
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user