Skip to content

Commit

Permalink
MySQL: Staat stil op: "Stats: Missing consumption data for: ..." #909
Browse files Browse the repository at this point in the history
  • Loading branch information
dennissiemensma committed Mar 3, 2020
1 parent dc3edcd commit b67791b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dsmr_frontend/tests/webinterface/test_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class TestViews(TestCase):
def setUp(self):
self.client = Client()
self.user = User.objects.create_user('testuser', 'unknown@localhost', 'passwd')
Notification.objects.all().delete() # Make sure notifications created by migrations are ignored.
Notification.objects.create(message='TEST2')
Notification.objects.create(message='TEST3')

Expand All @@ -34,7 +35,7 @@ def test_xhr_notification_read(self):
view_url = reverse('{}:notification-xhr-mark-read'.format(self.namespace))
notification = Notification.objects.all()[0]
self.assertFalse(notification.read)
self.assertEqual(Notification.objects.unread().count(), 3)
self.assertEqual(Notification.objects.unread().count(), 2)

# Check login required.
response = self.client.post(view_url)
Expand All @@ -49,13 +50,13 @@ def test_xhr_notification_read(self):
self.assertEqual(response.status_code, 200, response.content)

# Notification should be altered now.
self.assertEqual(Notification.objects.unread().count(), 2)
self.assertEqual(Notification.objects.unread().count(), 1)
notification.refresh_from_db()
self.assertTrue(notification.read)

def test_xhr_all_notifications_read(self):
view_url = reverse('{}:notification-xhr-mark-all-read'.format(self.namespace))
self.assertEqual(Notification.objects.unread().count(), 3)
self.assertEqual(Notification.objects.unread().count(), 2)

# Check login required.
response = self.client.post(view_url)
Expand Down

0 comments on commit b67791b

Please sign in to comment.