Skip to content

Commit

Permalink
test: add limited account scenario to unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
farmerpaul committed Nov 8, 2024
1 parent f3ae538 commit ac857e4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/apps/subjects/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,17 +1074,21 @@ async def test_get_target_subjects_by_respondent_multiple_assignments(
assert shell_account_result["submissionCount"] == 0
assert shell_account_result["currentlyAssigned"] is True

@pytest.mark.parametrize("subject_type", ["target", "respondent"])
async def test_get_target_subjects_by_respondent_via_submission(
self,
client,
tom: User,
tom_applet_one_subject: Subject,
lucy_applet_one_subject: Subject,
applet_one_shell_account: Subject,
subject_type: str,
applet_one_lucy_respondent: AppletFull,
answer_create_payload: dict,
session: AsyncSession,
):
activity = applet_one_lucy_respondent.activities[0]
source_subject = lucy_applet_one_subject if subject_type == "respondent" else applet_one_shell_account

# Turn off auto-assignment
activity_service = ActivityService(session, tom.id)
Expand All @@ -1104,15 +1108,15 @@ async def test_get_target_subjects_by_respondent_via_submission(
AppletAnswerCreate(
**answer_create_payload,
input_subject_id=lucy_applet_one_subject.id,
source_subject_id=lucy_applet_one_subject.id,
source_subject_id=source_subject.id,
target_subject_id=tom_applet_one_subject.id,
)
)

client.login(tom)

url = self.subject_target_by_respondent_url.format(
respondent_subject_id=lucy_applet_one_subject.id, activity_or_flow_id=str(activity.id)
respondent_subject_id=source_subject.id, activity_or_flow_id=str(activity.id)
)
response = await client.get(url)
assert response.status_code == http.HTTPStatus.OK
Expand Down

0 comments on commit ac857e4

Please sign in to comment.