-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Michal Konecny <[email protected]>
- Loading branch information
Showing
2 changed files
with
21 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 |
---|---|---|
|
@@ -1128,6 +1128,21 @@ def test_is_admin_configured(self): | |
self.assertTrue(user.is_admin) | ||
self.assertTrue(user.admin) | ||
|
||
def test_is_admin_configured_email(self): | ||
"""Assert default value for admin flag.""" | ||
user = models.User(email="[email protected]", username="user", admin=False) | ||
self.session.add(user) | ||
self.session.commit() | ||
|
||
mock_dict = mock.patch.dict( | ||
"anitya.config.config", {"ANITYA_WEB_ADMINS": [six.text_type(user.email)]} | ||
) | ||
|
||
with mock_dict: | ||
self.assertFalse(user.admin) | ||
self.assertTrue(user.is_admin) | ||
self.assertTrue(user.admin) | ||
|
||
def test_to_dict(self): | ||
"""Assert the correct dictionary is returned.""" | ||
user = models.User(email="[email protected]", username="user") | ||
|