-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
818eea7
commit d983484
Showing
15 changed files
with
229 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ class TestAnswerActivityItems(BaseTest): | |
file_id = "1693560380000/c60859c4-6f5f-4390-a572-da85fcd59709" | ||
|
||
@mock.patch("infrastructure.utility.cdn_arbitrary.ArbitraryS3CdnClient.upload") | ||
async def test_arbitrary_upload_to_s3_aws(self, mock_client: mock.MagicMock, session, client, **kwargs): | ||
async def test_arbitrary_upload_to_s3_aws(self, mock_client: mock.MagicMock, session, client, tom): | ||
await client.login(self.login_url, "[email protected]", "Test1234!") | ||
await set_storage_type(StorageType.AWS, session) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
from apps.mailing.services import TestMail | ||
from apps.shared.test import BaseTest | ||
from apps.subjects.crud import SubjectsCrud | ||
from apps.users import UserSchema | ||
from apps.users.domain import UserCreate, UserCreateRequest | ||
|
||
|
||
|
@@ -821,15 +822,13 @@ async def test_invite_and_accept_invitation_as_respondent( | |
assert subjects_on_applet2 == subjects_on_applet1 | ||
|
||
async def test_invite_and_accept_invitation_as_manager( | ||
self, client, session, invitation_manager_data | ||
self, client, session, invitation_manager_data, tom: UserSchema, user: UserSchema | ||
): | ||
subject_crud = SubjectsCrud(session) | ||
applet_id = uuid.UUID("92917a56-d586-4613-b7aa-991f2c4b15b1") | ||
mike_email = "[email protected]" | ||
mike_id = uuid.UUID("6a180cd9-db2b-4195-a5ac-30a8733dfb06") | ||
# Create invitation to Mike | ||
await client.login(self.login_url, "[email protected]", "Test1234!") | ||
invitation_manager_data.email = mike_email | ||
# Create invitation to User | ||
await client.login(self.login_url, tom.email_encrypted, "Test1234!") | ||
invitation_manager_data.email = user.email_encrypted | ||
subjects_on_applet0 = await subject_crud.count(applet_id=applet_id) | ||
response = await client.post( | ||
self.invite_manager_url.format(applet_id=applet_id), | ||
|
@@ -840,23 +839,21 @@ async def test_invite_and_accept_invitation_as_manager( | |
assert subjects_on_applet1 == subjects_on_applet0 | ||
invitation = response.json()["result"] | ||
# Login as Mike and accept invitation | ||
await client.login(self.login_url, mike_email, "Test1234!") | ||
await client.login(self.login_url, user.email_encrypted, "Test1234!") | ||
url_accept = self.accept_url.format(key=invitation["key"]) | ||
response = await client.post(url_accept) | ||
assert response.status_code == http.HTTPStatus.OK | ||
subject = await subject_crud.get(mike_id, applet_id) | ||
subject = await subject_crud.get(user.id, applet_id) | ||
assert subject | ||
subjects_on_applet2 = await subject_crud.count(applet_id=applet_id) | ||
assert subjects_on_applet2 == (subjects_on_applet1 + 1) | ||
|
||
async def test_private_invitation_accept_crate_subject( | ||
self, client, session | ||
self, client, session, user: UserSchema | ||
): | ||
subject_crud = SubjectsCrud(session) | ||
mike_id = uuid.UUID("6a180cd9-db2b-4195-a5ac-30a8733dfb06") | ||
mike_email = "[email protected]" | ||
applet_id = uuid.UUID("92917a56-d586-4613-b7aa-991f2c4b15b3") | ||
await client.login(self.login_url, mike_email, "Test1234!") | ||
await client.login(self.login_url, user.email_encrypted, "Test1234!") | ||
count0 = await subject_crud.count(applet_id=applet_id) | ||
response = await client.post( | ||
self.accept_private_url.format( | ||
|
@@ -866,5 +863,5 @@ async def test_private_invitation_accept_crate_subject( | |
assert response.status_code == http.HTTPStatus.OK | ||
count1 = await subject_crud.count(applet_id=applet_id) | ||
assert (count0 + 1) == count1 | ||
subject = subject_crud.get(mike_id, applet_id) | ||
subject = subject_crud.get(user.id, applet_id) | ||
assert subject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,28 +20,6 @@ | |
"plain_last_name": "Isaak" | ||
} | ||
}, | ||
{ | ||
"table": "subjects", | ||
"fields": { | ||
"id": "d552a73e-0dfe-41ee-9602-49d85994b1cb", | ||
"created_at": "2023-01-05T15:49:51.752113", | ||
"updated_at": "2023-01-05T15:49:51.752113", | ||
"applet_id": "92917a56-d586-4613-b7aa-991f2c4b15b1", | ||
"user_id": "7484f34a-3acc-4ee6-8a94-fd7299502fa7", | ||
"language": "en", | ||
"nickname": "hFywashKw+KlcDPazIy5QHz4AdkTOYkD28Q8+dpeDDA=", | ||
"secret_user_id": "7d31e08b-f552-45c2-a0f3-fcac9251685b", | ||
"email": "wR8cW30TKhQwbCCddfawUoOe1rXUZYBl4bmgF7NWDu+qbYXlU9Qjcxb+AJugpF9+", | ||
"first_name": "xjYl6DpzZ1uq+KofwSTn7w==", | ||
"last_name": "YRCR7GN7zM6TsUQOSLMmvw==", | ||
"creator_id": "7484f34a-3acc-4ee6-8a94-fd7299502fa1" | ||
}, | ||
"note": { | ||
"plain_first_name": "first_name", | ||
"plain_last_name": "last_name", | ||
"plan_email": "[email protected]" | ||
} | ||
}, | ||
{ | ||
"table": "subjects", | ||
"fields": { | ||
|
@@ -110,14 +88,14 @@ | |
},{ | ||
"table": "subjects", | ||
"fields": { | ||
"id": "7484f34a-3acc-4ee6-8a94-fd7299502fa6", | ||
"id": "f07ccfd2-20b0-4fdb-8c9c-73dd90784db8", | ||
"created_at": "2023-01-05T15:49:51.752113", | ||
"updated_at": "2023-01-05T15:49:51.752113", | ||
"applet_id": "92917a56-d586-4613-b7aa-991f2c4b15b1", | ||
"user_id": "7484f34a-3acc-4ee6-8a94-fd7299502fa6", | ||
"user_id": "7484f34a-3acc-4ee6-8a94-fd7299502fa7", | ||
"language": "en", | ||
"nickname": "hFywashKw+KlcDPazIy5QHz4AdkTOYkD28Q8+dpeDDA=", | ||
"secret_user_id": "2f04d02e-9f75-4405-a17b-3004a747d079", | ||
"secret_user_id": "0bb3032b-8bd4-48f6-8a00-92ca43d658b0", | ||
"email": "G/fUWdjS0euNqM0EuhcsKQ==", | ||
"first_name": "G3pm+lDvNouDFrSGQx6myg==", | ||
"last_name": "qZ9yEVQaDanvs9mB58OQQw==", | ||
|
@@ -126,7 +104,7 @@ | |
"note": { | ||
"plain_first_name": "first_name", | ||
"plain_last_name": "last_name", | ||
"plan_email": "plan_email" | ||
"plan_email": "[email protected]" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
from apps.subjects.crud import SubjectsCrud | ||
from apps.subjects.domain import Subject, SubjectCreateRequest, SubjectRespondentCreate | ||
from apps.subjects.services import SubjectsService | ||
from apps.users import UserSchema | ||
|
||
|
||
@pytest.fixture | ||
|
@@ -141,7 +142,6 @@ def answer_create_arbitrary_payload(): | |
|
||
class TestSubjects(BaseTest): | ||
fixtures = [ | ||
"users/fixtures/users.json", | ||
"applets/fixtures/applets.json", | ||
"applets/fixtures/applet_user_accesses.json", | ||
"applets/fixtures/applet_histories.json", | ||
|
@@ -365,7 +365,7 @@ async def test_successfully_delete_subject_with_answers( | |
# Coordinator | ||
("[email protected]", "Test1234!", http.HTTPStatus.OK), | ||
# Editor | ||
("[email protected]", "Test1234!", http.HTTPStatus.FORBIDDEN), | ||
("[email protected]", "Test1234", http.HTTPStatus.FORBIDDEN), | ||
# Reviewer | ||
("[email protected]", "Test1234!", http.HTTPStatus.FORBIDDEN) | ||
)) | ||
|
@@ -386,12 +386,12 @@ async def test_error_try_delete_subject_by_not_owner( | |
assert res.status_code == expected | ||
|
||
@pytest.mark.parametrize("subject_id,expected_code", ( | ||
("7484f34a-3acc-4ee6-8a94-fd7299502fa6", http.HTTPStatus.OK), | ||
("89ba6774-4f48-4ff1-9d34-0e6efd24f03f", http.HTTPStatus.OK), | ||
("ee96b767-4609-4b8b-93c5-e7b15b81c6f7", http.HTTPStatus.FORBIDDEN), | ||
(uuid.uuid4(), http.HTTPStatus.NOT_FOUND) | ||
)) | ||
async def test_get_subject(self, client, subject_id, expected_code): | ||
await client.login(self.login_url, "reviewer@mail.com", "Test1234!") | ||
async def test_get_subject(self, client, reviewer: UserSchema, subject_id, expected_code): | ||
await client.login(self.login_url, reviewer.email_encrypted, "Test1234!") | ||
response = await client.get( | ||
self.subject_detail_url.format(subject_id=subject_id) | ||
) | ||
|
Oops, something went wrong.