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.

30 lines
1013 B

  1. from hc.test import BaseTestCase
  2. from hc.api.models import Check
  3. class SwitchTeamTestCase(BaseTestCase):
  4. def test_it_switches(self):
  5. c = Check(user=self.alice, name="This belongs to Alice")
  6. c.save()
  7. self.client.login(username="[email protected]", password="password")
  8. url = "/accounts/switch_team/%s/" % self.alice.username
  9. r = self.client.get(url, follow=True)
  10. self.assertContains(r, "This belongs to Alice")
  11. def test_it_checks_team_membership(self):
  12. self.client.login(username="[email protected]", password="password")
  13. url = "/accounts/switch_team/%s/" % self.alice.username
  14. r = self.client.get(url)
  15. self.assertEqual(r.status_code, 403)
  16. def test_it_switches_to_own_team(self):
  17. self.client.login(username="[email protected]", password="password")
  18. url = "/accounts/switch_team/%s/" % self.alice.username
  19. r = self.client.get(url, follow=True)
  20. self.assertEqual(r.status_code, 200)