Skip to content

Commit

Permalink
Add additional MI Scope Report tests for new notes format
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMillar-MOJ committed Nov 4, 2024
1 parent 3a81f2d commit 70c2583
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions cla_backend/apps/reports/tests/test_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,52 @@ def test_report_client_public_diagnosis_note(self):
}
self.assertDictContainsSubset(expected, dict(report[0]))

def test_report_client_new_frontend(self):
eligible_case = make_recipe("legalaid.eligible_case", source="WEB")
eligible_case.eligibility_check.notes = self.get_notes_public_diagnosis_note()
eligible_case.eligibility_check.save()

self.assertEqual(eligible_case.eligibility_check.state, "yes")
self.assertEqual(eligible_case.diagnosis.state, "INSCOPE")
self.assertEqual(eligible_case.source, "WEB")

report = self.get_report()
expected = {
"Web diagnosis category 1": "Discrimination",
"Web diagnosis category 2": "Work - including colleagues, employer or employment agency",
"Web diagnosis category 3": "Disability, health condition, mental health condition",
"Web diagnosis category 4": "",
"Web diagnosis category 5": "",
"Web diagnosis category 6": "",
"Web scope state": "INSCOPE",
"Client notes": "",
"Workflow status": "Operator",
}
self.assertDictContainsSubset(expected, dict(report[0]))

def test_report_client_new_frontend_public_diagnsosis_note(self):
eligible_case = make_recipe("legalaid.eligible_case", source="WEB")
eligible_case.eligibility_check.notes = self.get_notes_public_diagnosis_note()
eligible_case.eligibility_check.save()

self.assertEqual(eligible_case.eligibility_check.state, "yes")
self.assertEqual(eligible_case.diagnosis.state, "CONTACT")
self.assertEqual(eligible_case.source, "WEB")

report = self.get_report()
expected = {
"Web diagnosis category 1": "Domestic Abuse",
"Web diagnosis category 2": "Help to protect you and your children",
"Web diagnosis category 3": "Yes",
"Web diagnosis category 4": "",
"Web diagnosis category 5": "",
"Web diagnosis category 6": "",
"Web scope state": "CONTACT",
"Client notes": "",
"Workflow status": "Operator",
}
self.assertDictContainsSubset(expected, dict(report[0]))

def test_report_workflow_status_pending(self):
eligible_case = make_recipe("legalaid.case", source="WEB")
self.assertEqual(eligible_case.source, "WEB")
Expand Down Expand Up @@ -737,3 +783,34 @@ def get_notes_public_diagnosis_note(self):
Outcome: CONTACT
"""

def get_notes_new_frontend(self):
return """User problem:
Optional data
User selected:
What do you need help with?: Discrimination
Where did the discrimination happen?: Work - including colleagues, employer or employment agency
Why were you treated differently?: Disability, health condition, mental health condition
Outcome: In Scope
"""

def get_notes_new_frontend_public_diagnsosis_note(self):
return """User problem:
Data
Public Diagnosis note:
User is at immediate risk of harm
User selected:
What do you need help with?: Domestic abuse
Domestic Abuse: Help to protect you and your children
Are you or your children at immediate risk of harm?: Yes
Outcome: In Scope - skip means test
"""

0 comments on commit 70c2583

Please sign in to comment.