forked from retoor/devplacepy
Add personal notes, DeepSearch history, backup offload, and gateway auth throttling
Also streamline the top navigation: drop the Tools dropdown, make Quizzes and Battles icon-only entries, and remove the Workspace, Containers and Editor entry points from the project detail page.
This commit is contained in:
@@ -207,6 +207,56 @@ def test_ws_sync_replays_messages_since(app_server):
|
||||
asyncio.run(run())
|
||||
|
||||
|
||||
def test_ws_active_marker_suppresses_message_notification(app_server):
|
||||
sender_session, sender_name = _member()
|
||||
receiver_session, receiver_name = _member()
|
||||
sender_uid = _db_user(sender_name)["uid"]
|
||||
receiver_uid = _db_user(receiver_name)["uid"]
|
||||
|
||||
async def run():
|
||||
async with websockets.connect(
|
||||
WS_URL, additional_headers=_cookie_header(receiver_session)
|
||||
) as receiver_ws:
|
||||
await _recv_until(receiver_ws, "ready")
|
||||
await receiver_ws.send(
|
||||
json.dumps({"type": "active", "with_uid": sender_uid})
|
||||
)
|
||||
|
||||
asyncio.run(run())
|
||||
|
||||
resp = sender_session.post(
|
||||
f"{BASE_URL}/messages/send",
|
||||
headers={"Accept": "application/json"},
|
||||
data={"content": "are you watching this", "receiver_uid": receiver_uid},
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
|
||||
refresh_snapshot()
|
||||
notifications = list(
|
||||
get_table("notifications").find(user_uid=receiver_uid, type="message")
|
||||
)
|
||||
assert notifications == []
|
||||
|
||||
|
||||
def test_ws_without_active_marker_still_notifies(app_server):
|
||||
sender_session, _ = _member()
|
||||
receiver_session, receiver_name = _member()
|
||||
receiver_uid = _db_user(receiver_name)["uid"]
|
||||
|
||||
resp = sender_session.post(
|
||||
f"{BASE_URL}/messages/send",
|
||||
headers={"Accept": "application/json"},
|
||||
data={"content": "hello without watching", "receiver_uid": receiver_uid},
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
|
||||
refresh_snapshot()
|
||||
notifications = list(
|
||||
get_table("notifications").find(user_uid=receiver_uid, type="message")
|
||||
)
|
||||
assert len(notifications) == 1
|
||||
|
||||
|
||||
def test_ws_ping_and_second_send_keep_the_socket_open(app_server):
|
||||
sender_session, _ = _member()
|
||||
receiver_session, receiver_name = _member()
|
||||
|
||||
Reference in New Issue
Block a user