-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #585 from colbyprior/json_test_fix
Fix Flaky Black Box Test for test_get_all_users
- Loading branch information
Showing
2 changed files
with
10 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,13 @@ def test_get_all_users(): | |
f'{env.AWG_BASE_URL}/api/users', | ||
headers=utils.BASE_HEADERS | ||
) | ||
assert json.loads(res.content.decode())['users'][0]['username'] == '[email protected]' | ||
assert json.loads(res.content.decode())['users'][0]['name']['first'] == 'Jeremy' | ||
test_user={} | ||
for user in json.loads(res.content.decode())['users']: | ||
if user['username'] == '[email protected]': | ||
test_user = user | ||
break | ||
assert test_user['username'] == '[email protected]' | ||
assert test_user['name']['first'] == 'Jeremy' | ||
assert '"secret"' not in res.content.decode() # check that no secrets are included | ||
assert res.status_code == 200 | ||
|
||
|
@@ -37,4 +42,4 @@ def test_org_admins_cannot_get_all_users(org_admin_headers): | |
headers=org_admin_headers | ||
) | ||
assert res.status_code == 403 | ||
response_contains_json(res, 'error', 'SECRETARIAT_ONLY') | ||
response_contains_json(res, 'error', 'SECRETARIAT_ONLY') |