diff options
| author | Barry Warsaw | 2015-07-13 21:00:31 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2015-07-13 21:01:51 -0400 |
| commit | 2332c029299aca991a36b7b4b29bacdf9b02537c (patch) | |
| tree | 2e44ddd3340c9caed31494873c714203dd2651eb /src/mailman/rest/tests/test_users.py | |
| parent | f1b93258259bbbf777d7bf290c0df69113a7adac (diff) | |
| download | mailman-2332c029299aca991a36b7b4b29bacdf9b02537c.tar.gz mailman-2332c029299aca991a36b7b4b29bacdf9b02537c.tar.zst mailman-2332c029299aca991a36b7b4b29bacdf9b02537c.zip | |
Diffstat (limited to 'src/mailman/rest/tests/test_users.py')
| -rw-r--r-- | src/mailman/rest/tests/test_users.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/mailman/rest/tests/test_users.py b/src/mailman/rest/tests/test_users.py index d58d7f9c3..6caaad401 100644 --- a/src/mailman/rest/tests/test_users.py +++ b/src/mailman/rest/tests/test_users.py @@ -245,6 +245,33 @@ class TestUsers(unittest.TestCase): content, response = call_api('http://localhost:9001/3.0/users') self.assertEqual(content['total_size'], 1) + def test_create_server_owner_false(self): + # Issue #136: Creating a user with is_server_owner=no should create + # user who is not a server owner. + content, response = call_api('http://localhost:9001/3.0/users', dict( + email='anne@example.com', + is_server_owner='no')) + anne = getUtility(IUserManager).get_user('anne@example.com') + self.assertFalse(anne.is_server_owner) + + def test_create_server_owner_true(self): + # Issue #136: Creating a user with is_server_owner=yes should create a + # new server owner user. + content, response = call_api('http://localhost:9001/3.0/users', dict( + email='anne@example.com', + is_server_owner='yes')) + anne = getUtility(IUserManager).get_user('anne@example.com') + self.assertTrue(anne.is_server_owner) + + def test_create_server_owner_bogus(self): + # Issue #136: Creating a user with is_server_owner=bogus should throw + # an exception. + with self.assertRaises(HTTPError) as cm: + call_api('http://localhost:9001/3.0/users', dict( + email='anne@example.com', + is_server_owner='bogus')) + self.assertEqual(cm.exception.code, 400) + def test_preferences_deletion_on_user_deletion(self): # LP: #1418276 - deleting a user did not delete their preferences. with transaction(): |
