Skip to content

Commit 6d6ad39

Browse files
committed
[deps] Added "channels" and "channels-test" extra requires
1 parent 72c5549 commit 6d6ad39

File tree

6 files changed

+12
-14
lines changed

6 files changed

+12
-14
lines changed

Diff for: openwisp_network_topology/consumers.py

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def connect(self):
4040

4141
def disconnect(self, close_code):
4242
self.close()
43-
pass
4443

4544
def send_topology_update(self, event):
4645
self.send(

Diff for: openwisp_network_topology/tests/test_websockets.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,10 @@ async def _assert_connection_org_manager(self, client, view_perm=True, conn=True
5959
)
6060
t = await database_sync_to_async(self._create_topology)(organization=org)
6161
if view_perm:
62-
topology_view_permission = await database_sync_to_async(
63-
Permission.objects.get
64-
)(codename='view_topology')
65-
await database_sync_to_async(test_user.user_permissions.add)(
66-
topology_view_permission
62+
topology_view_permission = await Permission.objects.aget(
63+
codename='view_topology'
6764
)
65+
await test_user.user_permissions.aadd(topology_view_permission)
6866
await database_sync_to_async(client.force_login)(test_user)
6967
communicator = await self._get_communicator(client, t.pk)
7068
connected, _ = await communicator.connect()
@@ -134,7 +132,7 @@ async def test_node_topology_update(self, admin_user, admin_client):
134132
response = await communicator.receive_json_from()
135133
assert response['topology'] is not None
136134
assert response['topology'] == expected_response
137-
await database_sync_to_async(node.delete)()
135+
await node.adelete()
138136
expected_response = await database_sync_to_async(topo.json)()
139137
response = await communicator.receive_json_from()
140138
assert response['topology'] is not None
@@ -164,12 +162,12 @@ async def test_link_topology_update(self, admin_user, admin_client):
164162
assert response['topology'] == expected_response
165163
link.status = 'down'
166164
await database_sync_to_async(link.full_clean)()
167-
await database_sync_to_async(link.save)()
165+
await link.asave()
168166
expected_response = await database_sync_to_async(topo.json)()
169167
response = await communicator.receive_json_from()
170168
assert response['topology'] is not None
171169
assert response['topology'] == expected_response
172-
await database_sync_to_async(link.delete)()
170+
await link.adelete()
173171
expected_response = await database_sync_to_async(topo.json)()
174172
response = await communicator.receive_json_from()
175173
assert response['topology'] is not None
@@ -184,7 +182,7 @@ async def test_topology_properties_update(self, admin_user, admin_client):
184182
assert connected is True
185183
topo.name = 'test'
186184
await database_sync_to_async(topo.full_clean)()
187-
await database_sync_to_async(topo.save)()
185+
await topo.asave()
188186
expected_response = await database_sync_to_async(topo.json)()
189187
response = await communicator.receive_json_from()
190188
assert response['topology'] is not None

Diff for: requirements-test.txt

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
responses~=0.25.7
2-
pytest-asyncio~=0.24.0
3-
pytest-django~=4.10.0
42
freezegun~=1.5.1
53
# Needed to test integrations
64
openwisp-monitoring @ https://github.com/openwisp/openwisp-monitoring/tarball/1.2
75
openwisp-controller @ https://github.com/openwisp/openwisp-controller/tarball/1.2
8-
openwisp-utils[qa,selenium] @ https://github.com/openwisp/openwisp-utils/tarball/1.2
6+
openwisp-utils[qa,selenium,channels-test] @ https://github.com/openwisp/openwisp-utils/tarball/1.2
97
redis~=5.2.1
108
django_redis~=5.4.0

Diff for: requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ openwisp-users @ https://github.com/openwisp/openwisp-users/tarball/1.2
22
netdiff @ https://github.com/openwisp/netdiff/tarball/1.2
33
jsonfield~=3.1.0
44
django-flat-json-widget~=0.3.1
5-
openwisp-utils[celery] @ https://github.com/openwisp/openwisp-utils/tarball/1.2
5+
openwisp-utils[celery,channels] @ https://github.com/openwisp/openwisp-utils/tarball/1.2

Diff for: tests/openwisp2/asgi.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from channels.auth import AuthMiddlewareStack
22
from channels.routing import ProtocolTypeRouter, URLRouter
33
from django.conf import settings
4+
from django.core.asgi import get_asgi_application
45

56
if 'openwisp_controller.geo' in settings.INSTALLED_APPS:
67
from openwisp_controller.routing import get_routes as get_controller_routes
@@ -27,5 +28,6 @@ def get_controller_routes():
2728
+ get_controller_routes()
2829
)
2930
),
31+
'http': get_asgi_application(),
3032
}
3133
)

Diff for: tests/openwisp2/settings.py

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
SECRET_KEY = '@q4z-^s=mv59#o=uutv4*m=h@)ik4%zp1)-k^_(!_7*x_&+ze$'
2121

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

0 commit comments

Comments
 (0)