Skip to content

Commit 46d606f

Browse files
Update tests.py
deleting in all the test key = uuid.uuid4() mocker.patch("uuid.uuid4", return_value=key) updating the exception: AccessDenied.message to TransferOwnershipAccessDenied.message
1 parent b644913 commit 46d606f

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

src/apps/transfer_ownership/tests.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from apps.applets.domain.applet_full import AppletFull
1212
from apps.applets.service import AppletService
1313
from apps.authentication.errors import PermissionsError
14-
from apps.authentication.errors import AccessDenied
1514
from apps.invitations.constants import InvitationStatus
1615
from apps.invitations.errors import ManagerInvitationExist
1716
from apps.mailing.services import TestMail
@@ -22,6 +21,7 @@
2221
from apps.transfer_ownership.crud import TransferCRUD
2322
from apps.transfer_ownership.errors import TransferEmailError
2423
from apps.users.domain import User
24+
from apps.workspaces.errors import TransferOwnershipAccessDenied
2525
from apps.workspaces.service.user_applet_access import UserAppletAccessService
2626

2727

@@ -546,66 +546,66 @@ async def test_decline_transfer__applet_not_in_transfer(
546546
assert result[0]["message"] == PermissionsError.message
547547

548548
async def test_manager_can_not_transfer_ownership(
549-
self, client: TestClient, applet_one: AppletFull, lucy: User, tom: User, mocker: MockerFixture
549+
self,
550+
client: TestClient,
551+
applet_one: AppletFull,
552+
lucy: User,
553+
tom: User,
550554
):
551555
client.login(lucy)
552556
data = {"email": tom.email_encrypted}
553-
key = uuid.uuid4()
554-
mocker.patch("uuid.uuid4", return_value=key)
555557
resp = await client.post(self.transfer_url.format(applet_id=applet_one.id), data=data)
556558
assert resp.status_code == http.HTTPStatus.FORBIDDEN
557-
assert resp.json()["result"][0]["message"] == AccessDenied.message
559+
assert resp.json()["result"][0]["message"] == TransferOwnershipAccessDenied.message
558560

559561
async def test_respondent_can_not_transfer_ownershipto(
560-
self, client: TestClient, applet_one_lucy_respondent: AppletFull, lucy: User, tom: User, mocker: MockerFixture
562+
self,
563+
client: TestClient,
564+
applet_one_lucy_respondent: AppletFull,
565+
lucy: User,
566+
tom: User,
561567
):
562568
client.login(lucy)
563569
data = {"email": tom.email_encrypted}
564-
key = uuid.uuid4()
565-
mocker.patch("uuid.uuid4", return_value=key)
566570
resp = await client.post(self.transfer_url.format(applet_id=applet_one_lucy_respondent.id), data=data)
567571
assert resp.status_code == http.HTTPStatus.FORBIDDEN
568-
assert resp.json()["result"][0]["message"] == AccessDenied.message
572+
assert resp.json()["result"][0]["message"] == TransferOwnershipAccessDenied.message
569573

570574
async def test_reviewer_can_not_transfer_ownership(
571575
self,
572576
client: TestClient,
573577
applet_one_bob_coordinator_reviewer: AppletFull,
574578
lucy: User,
575579
tom: User,
576-
mocker: MockerFixture,
577580
):
578581
client.login(lucy)
579582
data = {"email": tom.email_encrypted}
580-
key = uuid.uuid4()
581-
mocker.patch("uuid.uuid4", return_value=key)
582583
resp = await client.post(self.transfer_url.format(applet_id=applet_one_bob_coordinator_reviewer.id), data=data)
583584
assert resp.status_code == http.HTTPStatus.FORBIDDEN
584-
assert resp.json()["result"][0]["message"] == AccessDenied.message
585+
assert resp.json()["result"][0]["message"] == TransferOwnershipAccessDenied.message
585586

586587
async def test_editor_can_not_transfer_ownership(
587-
self, client: TestClient, applet_one_lucy_editor: AppletFull, lucy: User, tom: User, mocker: MockerFixture
588+
self,
589+
client: TestClient,
590+
applet_one_lucy_editor: AppletFull,
591+
lucy: User,
592+
tom: User,
588593
):
589594
client.login(lucy)
590595
data = {"email": tom.email_encrypted}
591-
key = uuid.uuid4()
592-
mocker.patch("uuid.uuid4", return_value=key)
593596
resp = await client.post(self.transfer_url.format(applet_id=applet_one_lucy_editor.id), data=data)
594597
assert resp.status_code == http.HTTPStatus.FORBIDDEN
595-
assert resp.json()["result"][0]["message"] == AccessDenied.message
598+
assert resp.json()["result"][0]["message"] == TransferOwnershipAccessDenied.message
596599

597600
async def test_coordinator_can_not_transfer_ownership(
598601
self,
599602
client: TestClient,
600603
applet_one_bob_coordinator_reviewer: AppletFull,
601604
lucy: User,
602605
tom: User,
603-
mocker: MockerFixture,
604606
):
605607
client.login(lucy)
606608
data = {"email": tom.email_encrypted}
607-
key = uuid.uuid4()
608-
mocker.patch("uuid.uuid4", return_value=key)
609609
resp = await client.post(self.transfer_url.format(applet_id=applet_one_bob_coordinator_reviewer.id), data=data)
610610
assert resp.status_code == http.HTTPStatus.FORBIDDEN
611-
assert resp.json()["result"][0]["message"] == AccessDenied.message
611+
assert resp.json()["result"][0]["message"] == TransferOwnershipAccessDenied.message

0 commit comments

Comments
 (0)