You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

notification_tests.py 617B

12345678910111213141516171819
  1. from django_dynamic_fixture import G
  2. from oscar.test.testcases import WebTestCase
  3. from oscar.core.compat import get_user_model
  4. from oscar.apps.customer.notifications import services
  5. User = get_user_model()
  6. class TestAUserWithUnreadNotifications(WebTestCase):
  7. def setUp(self):
  8. self.user = G(User)
  9. services.notify_user(self.user, "Test message")
  10. def test_can_see_them_in_page_header(self):
  11. homepage = self.app.get('/', user=self.user)
  12. self.assertTrue('num_unread_notifications' in homepage.context)
  13. self.assertEqual(1, homepage.context['num_unread_notifications'])