Skip to content

Commit 91fe021

Browse files
committed
ADCM-5580: refactor test_rbac_superuser.py
1 parent bc11d3c commit 91fe021

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

python/api_v2/tests/test_rbac_superuser.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@
1919
from rbac.services.user import perform_user_creation
2020
from rest_framework.response import Response
2121
from rest_framework.status import HTTP_200_OK, HTTP_201_CREATED, HTTP_403_FORBIDDEN, HTTP_409_CONFLICT
22-
from rest_framework.test import APIClient
2322

24-
from api_v2.tests.base import BaseAPITestCase
23+
from api_v2.tests.base import ADCMTestClient, BaseAPITestCase
2524

2625

2726
class TestUserCreateEdit(BaseAPITestCase):
@@ -55,9 +54,9 @@ def setUp(self) -> None:
5554
)
5655
)
5756

58-
self.creator_client = APIClient()
57+
self.creator_client = self.client_class()
5958
self.creator_client.login(username="icancreate", password=self.password)
60-
self.editor_client = APIClient()
59+
self.editor_client = self.client_class()
6160
self.editor_client.login(username="icanedit", password=self.password)
6261

6362
policy_create(name="Creators policy", role=create_user_role, group=[creators_group])
@@ -72,12 +71,12 @@ def setUp(self) -> None:
7271
}
7372

7473
@staticmethod
75-
def request_create_user(client: APIClient, data: dict) -> Response:
76-
return client.post(path="/api/v2/rbac/users/", data=data)
74+
def request_create_user(client: ADCMTestClient, data: dict) -> Response:
75+
return (client.v2 / "rbac" / "users").post(data=data)
7776

7877
@staticmethod
79-
def request_edit_user(client: APIClient, user_id: int, data: dict) -> Response:
80-
return client.patch(path=f"/api/v2/rbac/users/{user_id}/", data=data)
78+
def request_edit_user(client: ADCMTestClient, user_id: int, data: dict) -> Response:
79+
return (client.v2 / "rbac" / "users" / str(user_id)).patch(data=data)
8180

8281
# Create Restrictions
8382

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy