Skip to content
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

Remove respondent dict and update test #446

Merged
merged 4 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _infra/helm/party/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 2.5.10
version: 2.5.11

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 2.5.10
appVersion: 2.5.11
16 changes: 0 additions & 16 deletions ras_party/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,22 +322,6 @@ def to_respondent_dict(self):
"password_reset_counter": self.password_reset_counter,
}

def to_dict(self) -> dict:
return {
"id": self.id,
"party_uuid": self.party_uuid,
"status": RespondentStatus(self.status).name,
"email_address": self.email_address,
"pending_email_address": self.pending_email_address,
"first_name": self.first_name,
"last_name": self.last_name,
"telephone": self.telephone,
"created_on": self.created_on,
"mark_for_deletion": self.mark_for_deletion,
"password_verification_token": self.password_verification_token,
"password_reset_counter": self.password_reset_counter,
}

def to_respondent_with_associations_dict(self):
respondent_dict = self.to_respondent_dict()
respondent_dict["associations"] = self._get_business_associations(self.businesses)
Expand Down
2 changes: 1 addition & 1 deletion ras_party/views/respondent_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def get_respondent_by_party_id(party_id: UUID) -> Response:

respondent = respondent_controller.get_respondent_by_party_id(party_id)
if respondent:
return make_response(respondent.to_dict(), 200)
return make_response(respondent.to_respondent_dict(), 200)

return make_response(f"respondent not found for party_id {party_id}", 404)

Expand Down
15 changes: 14 additions & 1 deletion test/test_respondent_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,22 @@ def test_get_respondents_by_party_id(self, respondents_by_party_id):

# Then a 200 is returned with the correct Respondent
json_response = json.loads(response.data)
expected_response = {
"emailAddress": "email address",
"firstName": "first name",
"id": "7ab8f3b6-f436-400d-8911-335a61ec58e5",
"lastName": "last name",
"markForDeletion": None,
"password_reset_counter": None,
"password_verification_token": None,
"pendingEmailAddress": None,
"sampleUnitType": "BI",
"status": "ACTIVE",
"telephone": "telephone",
}
respondent["status"] = "ACTIVE" # The to_dict is returning the ResponseStatus name so this needs to be updated
self.assertEqual(response.status_code, 200)
self.assertEqual(json_response, json_response | respondent)
self.assertEqual(json_response, expected_response)

def test_get_respondents_by_party_id_invalid_uuid(self):
# Given/When the end point is called with an invalid uuid for party_id
Expand Down
Loading