Skip to content

Commit

Permalink
[Closes #234] Basic search/replace of Tester with iwt, including sche…
Browse files Browse the repository at this point in the history
…ma doc (#235)

* basic search/replace of Tester with iwt, including schema doc

* 234 Black formatting for test_appuser.py

* #234 simplify prefixes list to just "iwt", document case insensitivity

---------

Co-authored-by: Jimmi <[email protected]>
  • Loading branch information
JimmiHagen and Jimmi authored Aug 8, 2024
1 parent e297ac1 commit 76f6463
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ zip: the user's home zip code
age: the user's self reported age
is_latino: enum of responses, see IsLatinoLabels in home/models/account.py
is_sf_resident: true/false if the zip code is in the list of SF zip codes
is_tester: true if the user is a tested, automatically set if the name includes Tester
is_tester: true if the user is a tested, automatically set if the name includes IWT or iwt
gender: enum of responses, see GenderLabels in home/models/account.py
gender_other: freeform text response if gender is Other
race: enum of responses, see RaceLabels in home/models/account.py
Expand Down
4 changes: 2 additions & 2 deletions home/tests/integration/appuser/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ def test_create_tester_appuser_success(self):
request_params = self.request_params.copy()
request_params.update(
{
"name": "Tester John",
"name": "IWT John",
"zip": "94105",
}
)
expected_response = self.expected_response.copy()
expected_response.update(
{
"name": "Tester John",
"name": "IWT John",
"zip": "94105",
"is_tester": True,
"is_sf_resident": True,
Expand Down
16 changes: 8 additions & 8 deletions home/tests/unit/api/test_appuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
class TestIsTester(TestCase):
def test_is_tester(self):
examples = [
("Tester A", True),
("Test B", False), # are we sure this is the behavior we want?
("tester c", True),
("Testerosa", False),
("tester-d", True),
("Tester_E", True),
("testrata", False),
("tester", False), # are we sure this is the behavior we want?
("Iwt A", True),
("Test B", False),
("iwt c", True),
("Iwterosa", False),
("iwt-d", True),
("Iwt_E", True),
("iwtrata", False),
("iwt", True),
]
for example, expected in examples:
self.assertEqual(
Expand Down
2 changes: 1 addition & 1 deletion home/views/api/appuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

# Determines whether Account is tester account, based on name prefix
def is_tester(name_field: str) -> bool:
possible_prefixes = ["tester-", "tester ", "tester_"]
possible_prefixes = ["iwt "]
return any(
[name_field.lower().startswith(prefix) for prefix in possible_prefixes]
)
Expand Down

0 comments on commit 76f6463

Please sign in to comment.