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.

21 lines
662 B

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