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.

17 lines
695 B

  1. from hc.accounts.models import Project
  2. from hc.test import BaseTestCase
  3. class AddProjectTestCase(BaseTestCase):
  4. def test_it_works(self):
  5. self.client.login(username="[email protected]", password="password")
  6. r = self.client.post("/projects/add/", {"name": "My Second Project"})
  7. p = Project.objects.get(owner=self.alice, name="My Second Project")
  8. self.assertRedirects(r, "/projects/%s/checks/" % p.code)
  9. self.assertEqual(str(p.code), p.badge_key)
  10. def test_it_rejects_get(self):
  11. self.client.login(username="[email protected]", password="password")
  12. r = self.client.get("/projects/add/")
  13. self.assertEqual(r.status_code, 405)