Commit ea1d7f36 authored by Barry Warsaw's avatar Barry Warsaw

Bump coverage to 100%

parent 85521fac
Pipeline #619076 passed with stage
......@@ -276,8 +276,7 @@ class ArchiverGetterSetter(GetterSetter):
# getting a new status. value will be the representation of the new
# boolean status.
archiver = self._archiver_set.get(attribute)
if archiver is None:
raise ValueError('No such archiver: {}'.format(attribute))
assert archiver is not None, attribute
archiver.is_enabled = as_boolean(value)
......
......@@ -200,6 +200,24 @@ class TestLists(unittest.TestCase):
self.assertIsNone(getUtility(IListManager).get('[email protected]'))
self.assertEqual(config.db.store.query(AcceptableAlias).count(), 0)
def test_bad_roster_matcher(self):
# Try to get a list's roster, but the roster name is bogus.
with self.assertRaises(HTTPError) as cm:
call_api('http://localhost:9001/3.0/lists/ant.example.com'
'/roster/bogus')
self.assertEqual(cm.exception.code, 404)
def test_bad_config_matcher(self):
with self.assertRaises(HTTPError) as cm:
call_api('http://localhost:9001/3.0/lists/ant.example.com'
'/config/volume/bogus')
self.assertEqual(cm.exception.code, 404)
def test_bad_list_get(self):
with self.assertRaises(HTTPError) as cm:
call_api('http://localhost:9001/3.0/lists/bogus.example.com')
self.assertEqual(cm.exception.code, 404)
class TestListArchivers(unittest.TestCase):
......@@ -230,8 +248,20 @@ class TestListArchivers(unittest.TestCase):
'http://localhost:9001/3.0/lists/bee.example.com/archivers')
self.assertEqual(cm.exception.code, 404)
def test_patch_status_on_bogus_archiver(self):
# You cannot set the status on an archiver the list doesn't know about.
def test_put_bogus_archiver(self):
# You cannot PUT on an archiver the list doesn't know about.
with self.assertRaises(HTTPError) as cm:
call_api(
'http://localhost:9001/3.0/lists/ant.example.com/archivers', {
'bogus-archiver': True,
},
method='PUT')
self.assertEqual(cm.exception.code, 400)
self.assertEqual(cm.exception.reason,
b'Unexpected parameters: bogus-archiver')
def test_patch_bogus_archiver(self):
# You cannot PATCH on an archiver the list doesn't know about.
with self.assertRaises(HTTPError) as cm:
call_api(
'http://localhost:9001/3.0/lists/ant.example.com/archivers', {
......@@ -364,6 +394,12 @@ class TestListDigests(unittest.TestCase):
self._mlist.subscribe(anne)
anne.preferences.delivery_mode = DeliveryMode.plaintext_digests
def test_bad_digest_url(self):
with self.assertRaises(HTTPError) as cm:
call_api(
'http://localhost:9001/3.0/lists/bogus.example.com/digest')
self.assertEqual(cm.exception.code, 404)
def test_post_nothing_to_do(self):
resource, response = call_api(
'http://localhost:9001/3.0/lists/ant.example.com/digest', {})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment