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.
 
 
 
 
 

26 lines
997 B

from hc.accounts.models import Project
from hc.test import BaseTestCase
class RemoveProjectTestCase(BaseTestCase):
def setUp(self):
super(RemoveProjectTestCase, self).setUp()
self.url = "/projects/%s/remove/" % self.project.code
def test_it_works(self):
self.client.login(username="[email protected]", password="password")
r = self.client.post("/projects/add/", {"name": "My Second Project"})
p = Project.objects.get(owner=self.alice, name="My Second Project")
self.assertRedirects(r, "/projects/%s/checks/" % p.code)
self.assertEqual(str(p.code), p.badge_key)
# Alice's current project should be the just created one
self.profile.refresh_from_db()
self.assertEqual(self.profile.current_project, p)
def test_it_rejects_get(self):
self.client.login(username="[email protected]", password="password")
r = self.client.get("/projects/add/")
self.assertEqual(r.status_code, 405)