-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7333079
commit 5e7c1fb
Showing
4 changed files
with
53 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import pytest | ||
import asyncio | ||
|
||
@pytest.fixture(scope='session') | ||
def event_loop(): | ||
"""Create an instance of the default event loop for each test case.""" | ||
loop = asyncio.get_event_loop_policy().new_event_loop() | ||
yield loop | ||
loop.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
# chat/routing.py | ||
from django.urls import re_path | ||
from channels.routing import ProtocolTypeRouter, URLRouter | ||
from django.urls import path | ||
from . import consumers | ||
|
||
from . import consumers as ow_consumers | ||
|
||
|
||
def get_routes(consumer=None): | ||
if not consumer: | ||
consumer = ow_consumers | ||
return [ | ||
re_path(r'ws/notification/$', consumer.NotificationConsumer.as_asgi()), | ||
] | ||
def get_routes(): | ||
return ProtocolTypeRouter({ | ||
"websocket": URLRouter([ | ||
path("ws/notifications/", consumers.NotificationConsumer.as_asgi()), | ||
]), | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters