Skip to content

Commit 3678d8d

Browse files
committed
[deps] Install channels dependencies from openwisp-utils extras
1 parent b7dff78 commit 3678d8d

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

requirements-test.txt

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
openwisp-utils[qa,selenium] @ https://github.com/openwisp/openwisp-utils/tarball/1.2
1+
openwisp-utils[qa,selenium,channels,channels-test] @ https://github.com/openwisp/openwisp-utils/tarball/1.2
22
django-cors-headers~=4.4.0
33
django-redis~=5.4.0
4-
channels_redis~=4.2.1
5-
pytest-asyncio~=0.24.0
6-
pytest-django~=4.10.0
74
freezegun~=1.5.1

requirements.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
django-notifications-hq~=1.8.3
2-
channels~=3.0.2
32
openwisp-users @ https://github.com/openwisp/openwisp-users/tarball/1.2
4-
openwisp-utils[rest,celery] @ https://github.com/openwisp/openwisp-utils/tarball/1.2
3+
openwisp-utils[rest,celery,channels] @ https://github.com/openwisp/openwisp-utils/tarball/1.2
54
markdown~=3.7.0

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ ignore = W605, W503, W504
1414

1515
[tool:pytest]
1616
DJANGO_SETTINGS_MODULE = openwisp2.settings
17-
python_files = test_websokcets.py
17+
python_files = test_websockets.py

tests/openwisp2/asgi.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from channels.auth import AuthMiddlewareStack
44
from channels.routing import ProtocolTypeRouter, URLRouter
5+
from django.core.asgi import get_asgi_application
56

67
from openwisp_notifications.websockets.routing import get_routes
78

@@ -11,13 +12,18 @@
1112
# the web socket consumer in your extended app.
1213
from .sample_notifications import consumers
1314

14-
application = ProtocolTypeRouter(
15-
{'websocket': AuthMiddlewareStack(URLRouter(get_routes(consumers)))}
16-
)
15+
routes = get_routes(consumers)
16+
1717
else:
1818
# Load openwisp_notifications consumers:
1919
# This can be used when you are extending the app but not making
2020
# any changes in the web socket consumer.
21-
application = ProtocolTypeRouter(
22-
{'websocket': AuthMiddlewareStack(URLRouter(get_routes()))}
23-
)
21+
routes = get_routes()
22+
23+
24+
application = ProtocolTypeRouter(
25+
{
26+
'websocket': (AuthMiddlewareStack(URLRouter(routes))),
27+
'http': get_asgi_application(),
28+
}
29+
)

tests/openwisp2/settings.py

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
SECRET_KEY = 'fn)t*+$)ugeyip6-#txyy$5wf2ervc0d2n#h)qb)y5@ly$t*@w'
2121

2222
INSTALLED_APPS = [
23+
'daphne',
2324
'django.contrib.auth',
2425
'django.contrib.contenttypes',
2526
'django.contrib.sessions',

0 commit comments

Comments
 (0)