Mercurial > kallithea
changeset 5210:ac5d236a995a
tests: improve robustness of notifications tests
The notifications tests make the assumption that there are no notifications
at the start of the test, which is explicitly asserted.
However, any other test, like the one introduced in commit 9a23b444a7fe
(pullrequests: detect invalid reviewers and raise HTTPBadRequest), could add
new notifications to the database, and thus fail these assertions.
Just like the notifications tests already cleaned all notifications at the
end of the test (tearDown), make sure to clean them at the start (setUp)
too.
author | Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> |
---|---|
date | Mon, 22 Jun 2015 14:56:01 +0200 |
parents | aacc82d4a967 |
children | 4a2a66bf93c5 |
files | kallithea/tests/models/test_notifications.py |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/tests/models/test_notifications.py Sat Jun 20 22:10:05 2015 +0200 +++ b/kallithea/tests/models/test_notifications.py Mon Jun 22 14:56:01 2015 +0200 @@ -41,6 +41,9 @@ Session().commit() self.assertEqual(Notification.query().all(), []) + def setUp(self): + self._clean_notifications() + def tearDown(self): self._clean_notifications() @@ -156,7 +159,6 @@ self.assertNotEqual(u2notification, None) def test_notification_counter(self): - self._clean_notifications() self.assertEqual([], Notification.query().all()) self.assertEqual([], UserNotification.query().all())