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.

test_reports.py 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. from django.urls import reverse
  2. from oscar.test.testcases import WebTestCase
  3. class ReportsDashboardTests(WebTestCase):
  4. is_staff = True
  5. def test_dashboard_is_accessible_to_staff(self):
  6. url = reverse('dashboard:reports-index')
  7. response = self.get(url)
  8. self.assertIsOk(response)
  9. def test_conditional_offers_no_date_range(self):
  10. url = reverse('dashboard:reports-index')
  11. response = self.get(url)
  12. response.form['report_type'] = 'conditional-offers'
  13. response.form.submit()
  14. self.assertIsOk(response)
  15. def test_conditional_offers_with_date_range(self):
  16. url = reverse('dashboard:reports-index')
  17. response = self.get(url)
  18. response.form['report_type'] = 'conditional-offers'
  19. response.form['date_from'] = '2017-01-01'
  20. response.form['date_to'] = '2017-12-31'
  21. response.form.submit()
  22. self.assertIsOk(response)
  23. def test_conditional_offers_with_date_range_download(self):
  24. url = reverse('dashboard:reports-index')
  25. response = self.get(url)
  26. response.form['report_type'] = 'conditional-offers'
  27. response.form['date_from'] = '2017-01-01'
  28. response.form['date_to'] = '2017-12-31'
  29. response.form['download'] = 'true'
  30. response.form.submit()
  31. self.assertIsOk(response)