Skip to content

Commit 21b922e

Browse files
committed
[tests] Added tests for multi-tenant admin
1 parent f59db27 commit 21b922e

File tree

4 files changed

+10
-20
lines changed

4 files changed

+10
-20
lines changed

openwisp_controller/config/migrations/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ def update_vpn_dhparam_length(apps, schema_editor):
2525

2626
def assign_permissions_to_groups(apps, schema_editor):
2727
create_default_permissions(apps, schema_editor)
28-
operators_and_admins_can_change = ["device", "config", "template"]
29-
operators_read_only_admins_manage = ["vpn"]
30-
manage_operations = ["add", "change", "delete"]
31-
Group = get_swapped_model(apps, "openwisp_users", "Group")
28+
operators_and_admins_can_change = ['device', 'config', 'template']
29+
operators_read_only_admins_manage = ['vpn']
30+
manage_operations = ['add', 'change', 'view', 'delete']
31+
Group = get_swapped_model(apps, 'openwisp_users', 'Group')
3232

3333
try:
3434
admin = Group.objects.get(name="Administrator")

openwisp_controller/config/tests/test_api.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -658,15 +658,6 @@ def test_operator_access_shared_template(self):
658658
update_payload={'name': 'updated-test'},
659659
expected_count=1,
660660
token=token,
661-
expected_status_codes={
662-
'create': 400,
663-
'list': 200,
664-
'retrieve': 403,
665-
'update': 403,
666-
'delete': 403,
667-
'head': 403,
668-
'option': 200,
669-
},
670661
)
671662

672663
def test_org_admin_create_template_with_shared_vpn(self):
@@ -689,16 +680,16 @@ def test_org_admin_create_template_with_shared_vpn(self):
689680
create_payload=create_payload,
690681
update_payload=update_payload,
691682
expected_count=1,
683+
token=self._obtain_auth_token(test_user),
692684
expected_status_codes={
693685
'create': 201,
694686
'list': 200,
695687
'retrieve': 200,
696688
'update': 200,
697689
'delete': 204,
698-
'head': 403,
690+
'head': 200,
699691
'option': 200,
700-
},
701-
token=self._obtain_auth_token(test_user),
692+
}
702693
)
703694

704695
def test_template_create_with_empty_config(self):

openwisp_controller/connection/api/serializers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ class Meta:
6464

6565
class CredentialSerializer(BaseSerializer):
6666
params = serializers.JSONField()
67-
include_shared = True
6867

6968
class Meta:
7069
model = Credentials

openwisp_controller/geo/migrations/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
def assign_permissions_to_groups(apps, schema_editor):
77
create_default_permissions(apps, schema_editor)
8-
operators_and_admins_can_change = ["location", "floorplan", "devicelocation"]
9-
manage_operations = ["add", "change", "delete"]
10-
Group = get_swapped_model(apps, "openwisp_users", "Group")
8+
operators_and_admins_can_change = ['location', 'floorplan', 'devicelocation']
9+
manage_operations = ['add', 'change', 'view', 'delete']
10+
Group = get_swapped_model(apps, 'openwisp_users', 'Group')
1111

1212
try:
1313
admin = Group.objects.get(name="Administrator")

0 commit comments

Comments
 (0)