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.

27 lines
998 B

  1. from hc.accounts.models import Project
  2. from hc.test import BaseTestCase
  3. class RemoveProjectTestCase(BaseTestCase):
  4. def setUp(self):
  5. super(RemoveProjectTestCase, self).setUp()
  6. self.url = "/projects/%s/remove/" % self.project.code
  7. def test_it_works(self):
  8. self.client.login(username="[email protected]", password="password")
  9. r = self.client.post("/projects/add/", {"name": "My Second Project"})
  10. p = Project.objects.get(owner=self.alice, name="My Second Project")
  11. self.assertRedirects(r, "/projects/%s/checks/" % p.code)
  12. self.assertEqual(str(p.code), p.badge_key)
  13. # Alice's current project should be the just created one
  14. self.profile.refresh_from_db()
  15. self.assertEqual(self.profile.current_project, p)
  16. def test_it_rejects_get(self):
  17. self.client.login(username="[email protected]", password="password")
  18. r = self.client.get("/projects/add/")
  19. self.assertEqual(r.status_code, 405)