-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tests on GoogleAdmin, expect new response structure
- Loading branch information
1 parent
c87fc62
commit fc20351
Showing
1 changed file
with
27 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,36 +31,41 @@ def setUp(self): | |
self.google_admin = MockGoogleAdmin() | ||
|
||
def test_aliases(self): | ||
self.google_admin.client.request = MagicMock( | ||
return_value=( | ||
"", | ||
'{"aliases": [{"alias": "[email protected]"},' | ||
'{"alias": "fakeemail8@fakedomain' | ||
'.com"}]}'.encode(), | ||
) | ||
) | ||
response_mock = MagicMock() | ||
self.google_admin.client.request = MagicMock(return_value=response_mock) | ||
response_mock.json.return_value = { | ||
"aliases": [ | ||
{"alias": "fakeemail7@fakedomain.com"}, | ||
{"alias": "fakeemail8@fakedomain.com"}, | ||
] | ||
} | ||
assert_matching_tables(self.google_admin.get_aliases("1"), self.mock_aliases) | ||
|
||
def test_all_group_members(self): | ||
self.google_admin.client.request = MagicMock( | ||
return_value=( | ||
"", | ||
'{"members": [{"email": "[email protected]"}]}'.encode(), | ||
) | ||
) | ||
response_mock = MagicMock() | ||
self.google_admin.client.request = MagicMock(return_value=response_mock) | ||
response_mock.json.return_value = {"members": [{"email": "[email protected]"}]} | ||
assert_matching_tables( | ||
self.google_admin.get_all_group_members("1"), self.mock_all_group_members | ||
) | ||
|
||
def test_all_groups(self): | ||
self.google_admin.client.request = MagicMock( | ||
return_value=( | ||
"", | ||
'{"groups": [{"aliases": ["[email protected]", "[email protected]"], "e' # noqa: E501 | ||
'mail": "[email protected]", "id": 1}, {"email": "[email protected]", "' # noqa: E501 | ||
'id": 2}, {"email": "[email protected]", "id": 3}]}'.encode(), | ||
) | ||
) | ||
response_mock = MagicMock() | ||
self.google_admin.client.request = MagicMock(return_value=response_mock) | ||
response_mock.json.return_value = { | ||
"groups": [ | ||
{ | ||
"aliases": [ | ||
"[email protected]", | ||
"[email protected]", | ||
], | ||
"email": "[email protected]", | ||
"id": 1, | ||
}, | ||
{"email": "[email protected]", "id": 2}, | ||
{"email": "[email protected]", "id": 3}, | ||
] | ||
} | ||
assert_matching_tables( | ||
self.google_admin.get_all_groups({"domain": "fakedomain.com"}), | ||
self.mock_all_groups, | ||
|