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.

29 lines
890 B

10 years ago
10 years ago
10 years ago
  1. from django.test import TestCase
  2. from django.test.utils import override_settings
  3. from hc.api.models import Check
  4. class BasicsTestCase(TestCase):
  5. def test_it_shows_welcome(self):
  6. r = self.client.get("/")
  7. self.assertContains(r, "Get Notified", status_code=200)
  8. def test_welcome_code(self):
  9. r = self.client.get("/")
  10. code = self.client.session["welcome_code"]
  11. assert Check.objects.filter(code=code).exists()
  12. self.client.session["welcome_code"] = "x"
  13. r = self.client.get("/")
  14. code = self.client.session["welcome_code"]
  15. assert r.status_code == 200
  16. assert code != "x"
  17. assert Check.objects.filter(code=code).exists()
  18. @override_settings(REGISTRATION_OPEN=False)
  19. def test_it_obeys_registration_open(self):
  20. r = self.client.get("/")
  21. self.assertNotContains(r, "Get Started")