Skip to content

Commit 30470ca

Browse files
committed
[tests] Added tests for multi-tenant admin
1 parent 66a5d69 commit 30470ca

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
@@ -681,15 +681,6 @@ def test_operator_access_shared_template(self):
681681
update_payload={'name': 'updated-test'},
682682
expected_count=1,
683683
token=token,
684-
expected_status_codes={
685-
'create': 400,
686-
'list': 200,
687-
'retrieve': 403,
688-
'update': 403,
689-
'delete': 403,
690-
'head': 403,
691-
'option': 200,
692-
},
693684
)
694685

695686
def test_org_admin_create_template_with_shared_vpn(self):
@@ -712,16 +703,16 @@ def test_org_admin_create_template_with_shared_vpn(self):
712703
create_payload=create_payload,
713704
update_payload=update_payload,
714705
expected_count=1,
706+
token=self._obtain_auth_token(test_user),
715707
expected_status_codes={
716708
'create': 201,
717709
'list': 200,
718710
'retrieve': 200,
719711
'update': 200,
720712
'delete': 204,
721-
'head': 403,
713+
'head': 200,
722714
'option': 200,
723-
},
724-
token=self._obtain_auth_token(test_user),
715+
}
725716
)
726717

727718
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)