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

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

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
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
JimmiHagen marked this conversation as resolved.
Show resolved Hide resolved
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),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised this case fails, as it technically starts with iwt

("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-", "iwt ", "iwt_"]
JimmiHagen marked this conversation as resolved.
Show resolved Hide resolved
return any(
[name_field.lower().startswith(prefix) for prefix in possible_prefixes]
)
Expand Down