|
|
- from hc.test import BaseTestCase
- from hc.api.models import Check
-
-
- class SwitchTeamTestCase(BaseTestCase):
-
- def test_it_switches(self):
- c = Check(user=self.alice, name="This belongs to Alice")
- c.save()
-
- self.client.login(username="[email protected]", password="password")
-
- url = "/accounts/switch_team/%s/" % self.alice.username
- r = self.client.get(url, follow=True)
-
- self.assertContains(r, "This belongs to Alice")
-
- def test_it_checks_team_membership(self):
- self.client.login(username="[email protected]", password="password")
-
- url = "/accounts/switch_team/%s/" % self.alice.username
- r = self.client.get(url)
- self.assertEqual(r.status_code, 403)
-
- def test_it_switches_to_own_team(self):
- self.client.login(username="[email protected]", password="password")
-
- url = "/accounts/switch_team/%s/" % self.alice.username
- r = self.client.get(url, follow=True)
- self.assertEqual(r.status_code, 200)
|