-
Notifications
You must be signed in to change notification settings - Fork 4
Transfer a survey improvement with duplicate pending survey error message #1035
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: survey-respondent-help-journey
Are you sure you want to change the base?
Changes from all commits
e605123
60d579a
2b8168d
80fbcd5
d17c44b
b08b74e
9e1874b
d17f864
6ca46b1
c538d78
fcd894f
b92ce88
f5beb1f
ad0672b
9d6c4cc
92219c2
68cfebb
296ae50
702f36a
61b3bc8
a298ae1
b2cc65d
1eb301c
f44643e
37634f1
5e80064
e74561e
dbd0153
4c6481b
d8fe3ca
8967463
a15b933
f7ebbca
7d24b2c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,10 +9,13 @@ | |
| business_party, | ||
| encoded_jwt_token, | ||
| party, | ||
| pending_surveys, | ||
| respondent_enrolments, | ||
| respondent_party, | ||
| survey, | ||
| url_banner_api, | ||
| url_get_existing_pending_surveys, | ||
| url_get_respondent_enrolments, | ||
| url_get_respondent_party, | ||
| url_get_survey, | ||
| ) | ||
|
|
@@ -153,12 +156,40 @@ def test_transfer_survey_recipient_email_invalid(self, mock_request): | |
| self.assertIn("Problem with the email address".encode(), response.data) | ||
| self.assertIn("Invalid email address".encode(), response.data) | ||
|
|
||
| @requests_mock.mock() | ||
| def test_transfer_survey_transfer_duplicates(self, mock_request): | ||
| mock_request.get(url_banner_api, status_code=404) | ||
| mock_request.get(url_get_respondent_party, status_code=200, json=respondent_party) | ||
| mock_request.get(url_get_business_details, status_code=200, json=[business_party]) | ||
| mock_request.get(url_get_survey, status_code=200, json=survey) | ||
| mock_request.get(url_get_existing_pending_surveys, status_code=200, json=pending_surveys) | ||
| mock_request.get(url_get_respondent_enrolments, json=respondent_enrolments) | ||
| with self.app.session_transaction() as mock_session: | ||
| mock_session["surveys_to_transfer_map"] = {business_party["id"]: [survey["id"]]} | ||
| response = self.app.post( | ||
| "/my-account/transfer-surveys/recipient-email-address", | ||
| data={"email_address": "bob@here.com"}, | ||
| follow_redirects=True, | ||
| ) | ||
| self.assertEqual(response.status_code, 200) | ||
| self.assertIn( | ||
| "You have already shared or transferred the following surveys to this email address.".encode(), | ||
| response.data, | ||
| ) | ||
| self.assertIn("They have 72 hours to accept your request.".encode(), response.data) | ||
| self.assertIn( | ||
| "<br /><br />If you have made an error then wait for the share/transfer to expire or contact us.".encode(), | ||
| response.data, | ||
| ) | ||
| self.assertIn("<ul><li>Business 3 - Survey 2</li></ul>".encode(), response.data) | ||
|
Comment on lines
+175
to
+184
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a bit naff, but again it tests the feature and message in one hit so serves its purpose. We might want to extend the test data to include multiple duplicates (e.g. more |
||
|
|
||
| @requests_mock.mock() | ||
| def test_transfer_survey_transfer_instruction(self, mock_request): | ||
| mock_request.get(url_banner_api, status_code=404) | ||
| mock_request.get(url_get_respondent_party, status_code=200, json=respondent_party) | ||
| mock_request.get(url_get_business_details, status_code=200, json=[business_party]) | ||
| mock_request.get(url_get_survey, status_code=200, json=survey) | ||
| mock_request.get(url_get_existing_pending_surveys, status_code=200, json=pending_surveys) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exiting implementation now requires a list of pending surveys originated by this respondent |
||
| with self.app.session_transaction() as mock_session: | ||
| mock_session["surveys_to_transfer_map"] = {business_party["id"]: [survey["id"]]} | ||
| response = self.app.post( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| [ | ||
| { | ||
| "batch_no": "be34d7ca-1d06-4f6e-98e3-73b80c911d32", | ||
| "business_id": "be3483c3-f5c9-4b13-bdd7-244db78ff687", | ||
| "email_address": "bob@here.com", | ||
| "is_transfer": true, | ||
| "shared_by": "f956e8ae-6e0f-4414-b0cf-a07c1aa3e37b", | ||
| "survey_id": "cb8accda-6118-4d3b-85a3-149e28960c54", | ||
| "time_shared": "2025-02-05 16:08:58" | ||
| } | ||
|
Comment on lines
+2
to
+10
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned, we could introduce more permutations of these to test various scenarios are covered. Fairly easy to do that. |
||
| ] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can probably be improved as it's clunky chaining this and including the HTML. But it's explicit and serves its purpose.