Change notificationworker test to pytest
This commit is contained in:
parent
50c2f1fde8
commit
8ec198228c
1 changed files with 25 additions and 38 deletions
|
@ -1,20 +1,11 @@
|
|||
import unittest
|
||||
|
||||
from data import model
|
||||
from workers.notificationworker import NotificationWorker
|
||||
from initdb import setup_database_for_testing, finished_database_for_testing
|
||||
from workers.notificationworker.notificationworker import NotificationWorker
|
||||
from test.fixtures import *
|
||||
|
||||
class NotificationWorkerTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
setup_database_for_testing(self)
|
||||
|
||||
def tearDown(self):
|
||||
finished_database_for_testing(self)
|
||||
|
||||
def test_basic_notification(self):
|
||||
def test_basic_notification(initialized_db):
|
||||
# Ensure the public user doesn't have any notifications.
|
||||
target_user = model.user.get_user('public')
|
||||
self.assertEquals(0, len(list(model.notification.list_notifications(target_user))))
|
||||
assert len(list(model.notification.list_notifications(target_user))) == 0
|
||||
|
||||
# Add a basic build notification.
|
||||
repo = model.repository.get_repository('devtable', 'simple')
|
||||
|
@ -38,8 +29,4 @@ class NotificationWorkerTests(unittest.TestCase):
|
|||
})
|
||||
|
||||
# Ensure the notification was handled.
|
||||
self.assertEquals(1, len(list(model.notification.list_notifications(target_user))))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
assert len(list(model.notification.list_notifications(target_user))) == 1
|
||||
|
|
Reference in a new issue