|
11 | 11 | from apps.applets.domain.applet_full import AppletFull |
12 | 12 | from apps.applets.service import AppletService |
13 | 13 | from apps.authentication.errors import PermissionsError |
14 | | -from apps.authentication.errors import AccessDenied |
15 | 14 | from apps.invitations.constants import InvitationStatus |
16 | 15 | from apps.invitations.errors import ManagerInvitationExist |
17 | 16 | from apps.mailing.services import TestMail |
|
22 | 21 | from apps.transfer_ownership.crud import TransferCRUD |
23 | 22 | from apps.transfer_ownership.errors import TransferEmailError |
24 | 23 | from apps.users.domain import User |
| 24 | +from apps.workspaces.errors import TransferOwnershipAccessDenied |
25 | 25 | from apps.workspaces.service.user_applet_access import UserAppletAccessService |
26 | 26 |
|
27 | 27 |
|
@@ -546,66 +546,66 @@ async def test_decline_transfer__applet_not_in_transfer( |
546 | 546 | assert result[0]["message"] == PermissionsError.message |
547 | 547 |
|
548 | 548 | 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, |
550 | 554 | ): |
551 | 555 | client.login(lucy) |
552 | 556 | data = {"email": tom.email_encrypted} |
553 | | - key = uuid.uuid4() |
554 | | - mocker.patch("uuid.uuid4", return_value=key) |
555 | 557 | resp = await client.post(self.transfer_url.format(applet_id=applet_one.id), data=data) |
556 | 558 | 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 |
558 | 560 |
|
559 | 561 | 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, |
561 | 567 | ): |
562 | 568 | client.login(lucy) |
563 | 569 | data = {"email": tom.email_encrypted} |
564 | | - key = uuid.uuid4() |
565 | | - mocker.patch("uuid.uuid4", return_value=key) |
566 | 570 | resp = await client.post(self.transfer_url.format(applet_id=applet_one_lucy_respondent.id), data=data) |
567 | 571 | 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 |
569 | 573 |
|
570 | 574 | async def test_reviewer_can_not_transfer_ownership( |
571 | 575 | self, |
572 | 576 | client: TestClient, |
573 | 577 | applet_one_bob_coordinator_reviewer: AppletFull, |
574 | 578 | lucy: User, |
575 | 579 | tom: User, |
576 | | - mocker: MockerFixture, |
577 | 580 | ): |
578 | 581 | client.login(lucy) |
579 | 582 | data = {"email": tom.email_encrypted} |
580 | | - key = uuid.uuid4() |
581 | | - mocker.patch("uuid.uuid4", return_value=key) |
582 | 583 | resp = await client.post(self.transfer_url.format(applet_id=applet_one_bob_coordinator_reviewer.id), data=data) |
583 | 584 | 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 |
585 | 586 |
|
586 | 587 | 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, |
588 | 593 | ): |
589 | 594 | client.login(lucy) |
590 | 595 | data = {"email": tom.email_encrypted} |
591 | | - key = uuid.uuid4() |
592 | | - mocker.patch("uuid.uuid4", return_value=key) |
593 | 596 | resp = await client.post(self.transfer_url.format(applet_id=applet_one_lucy_editor.id), data=data) |
594 | 597 | 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 |
596 | 599 |
|
597 | 600 | async def test_coordinator_can_not_transfer_ownership( |
598 | 601 | self, |
599 | 602 | client: TestClient, |
600 | 603 | applet_one_bob_coordinator_reviewer: AppletFull, |
601 | 604 | lucy: User, |
602 | 605 | tom: User, |
603 | | - mocker: MockerFixture, |
604 | 606 | ): |
605 | 607 | client.login(lucy) |
606 | 608 | data = {"email": tom.email_encrypted} |
607 | | - key = uuid.uuid4() |
608 | | - mocker.patch("uuid.uuid4", return_value=key) |
609 | 609 | resp = await client.post(self.transfer_url.format(applet_id=applet_one_bob_coordinator_reviewer.id), data=data) |
610 | 610 | 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