@ -76,8 +76,6 @@ class ProjectTestCase(BaseTestCase): | |||||
project=self.project, user__email="[email protected]" | project=self.project, user__email="[email protected]" | ||||
) | ) | ||||
profile = member.user.profile | |||||
self.assertEqual(profile.current_project, self.project) | |||||
# The new user should not have their own project | # The new user should not have their own project | ||||
self.assertFalse(member.user.project_set.exists()) | self.assertFalse(member.user.project_set.exists()) | ||||
@ -148,10 +146,7 @@ class ProjectTestCase(BaseTestCase): | |||||
r = self.client.post(self.url, form) | r = self.client.post(self.url, form) | ||||
self.assertEqual(r.status_code, 200) | self.assertEqual(r.status_code, 200) | ||||
self.assertEqual(Member.objects.count(), 0) | |||||
self.bobs_profile.refresh_from_db() | |||||
self.assertEqual(self.bobs_profile.current_project, None) | |||||
self.assertFalse(Member.objects.exists()) | |||||
def test_it_requires_owner_to_remove_team_member(self): | def test_it_requires_owner_to_remove_team_member(self): | ||||
self.client.login(username="[email protected]", password="password") | self.client.login(username="[email protected]", password="password") | ||||
@ -161,9 +156,6 @@ class ProjectTestCase(BaseTestCase): | |||||
self.assertEqual(r.status_code, 403) | self.assertEqual(r.status_code, 403) | ||||
def test_it_checks_membership_when_removing_team_member(self): | def test_it_checks_membership_when_removing_team_member(self): | ||||
self.profile.current_project = self.project | |||||
self.profile.save() | |||||
self.client.login(username="[email protected]", password="password") | self.client.login(username="[email protected]", password="password") | ||||
url = "/projects/%s/settings/" % self.charlies_project.code | url = "/projects/%s/settings/" % self.charlies_project.code | ||||
@ -171,9 +163,6 @@ class ProjectTestCase(BaseTestCase): | |||||
r = self.client.post(url, form) | r = self.client.post(url, form) | ||||
self.assertEqual(r.status_code, 400) | self.assertEqual(r.status_code, 400) | ||||
self.profile.refresh_from_db() | |||||
self.assertIsNotNone(self.profile.current_project) | |||||
def test_it_sets_project_name(self): | def test_it_sets_project_name(self): | ||||
self.client.login(username="[email protected]", password="password") | self.client.login(username="[email protected]", password="password") | ||||
@ -19,19 +19,6 @@ class AddCheckTestCase(BaseTestCase): | |||||
redirect_url = "/checks/%s/details/?new" % check.code | redirect_url = "/checks/%s/details/?new" % check.code | ||||
self.assertRedirects(r, redirect_url) | self.assertRedirects(r, redirect_url) | ||||
def test_it_handles_unset_current_project(self): | |||||
self.profile.current_project = None | |||||
self.profile.save() | |||||
self.client.login(username="[email protected]", password="password") | |||||
r = self.client.post(self.url) | |||||
check = Check.objects.get() | |||||
self.assertEqual(check.project, self.project) | |||||
redirect_url = "/checks/%s/details/?new" % check.code | |||||
self.assertRedirects(r, redirect_url) | |||||
def test_team_access_works(self): | def test_team_access_works(self): | ||||
self.client.login(username="[email protected]", password="password") | self.client.login(username="[email protected]", password="password") | ||||
self.client.post(self.url) | self.client.post(self.url) | ||||
@ -37,9 +37,6 @@ class DetailsTestCase(BaseTestCase): | |||||
self.assertContains(r, "Cron Expression", status_code=200) | self.assertContains(r, "Cron Expression", status_code=200) | ||||
def test_it_allows_cross_team_access(self): | def test_it_allows_cross_team_access(self): | ||||
self.bobs_profile.current_project = None | |||||
self.bobs_profile.save() | |||||
self.client.login(username="[email protected]", password="password") | self.client.login(username="[email protected]", password="password") | ||||
r = self.client.get(self.url) | r = self.client.get(self.url) | ||||
self.assertEqual(r.status_code, 200) | self.assertEqual(r.status_code, 200) | ||||
@ -91,9 +91,6 @@ class LogTestCase(BaseTestCase): | |||||
self.assertContains(r, "Called webhook foo/$NAME", status_code=200) | self.assertContains(r, "Called webhook foo/$NAME", status_code=200) | ||||
def test_it_allows_cross_team_access(self): | def test_it_allows_cross_team_access(self): | ||||
self.bobs_profile.current_project = None | |||||
self.bobs_profile.save() | |||||
self.client.login(username="[email protected]", password="password") | self.client.login(username="[email protected]", password="password") | ||||
r = self.client.get(self.url) | r = self.client.get(self.url) | ||||
self.assertEqual(r.status_code, 200) | self.assertEqual(r.status_code, 200) |
@ -26,9 +26,6 @@ class PauseTestCase(BaseTestCase): | |||||
self.assertEqual(r.status_code, 405) | self.assertEqual(r.status_code, 405) | ||||
def test_it_allows_cross_team_access(self): | def test_it_allows_cross_team_access(self): | ||||
self.bobs_profile.current_project = None | |||||
self.bobs_profile.save() | |||||
self.client.login(username="[email protected]", password="password") | self.client.login(username="[email protected]", password="password") | ||||
r = self.client.post(self.url) | r = self.client.post(self.url) | ||||
self.assertRedirects(r, self.redirect_url) | self.assertRedirects(r, self.redirect_url) | ||||
@ -48,9 +48,6 @@ class RemoveCheckTestCase(BaseTestCase): | |||||
self.assertEqual(r.status_code, 405) | self.assertEqual(r.status_code, 405) | ||||
def test_it_allows_cross_team_access(self): | def test_it_allows_cross_team_access(self): | ||||
self.bobs_profile.current_project = None | |||||
self.bobs_profile.save() | |||||
self.client.login(username="[email protected]", password="password") | self.client.login(username="[email protected]", password="password") | ||||
r = self.client.post(self.remove_url) | r = self.client.post(self.remove_url) | ||||
self.assertRedirects(r, self.redirect_url) | self.assertRedirects(r, self.redirect_url) |
@ -25,17 +25,11 @@ class MyChecksTestCase(BaseTestCase): | |||||
self.assertIn("Never", detail["last_ping"]) | self.assertIn("Never", detail["last_ping"]) | ||||
def test_it_allows_cross_team_access(self): | def test_it_allows_cross_team_access(self): | ||||
self.bobs_profile.current_project = None | |||||
self.bobs_profile.save() | |||||
self.client.login(username="[email protected]", password="password") | self.client.login(username="[email protected]", password="password") | ||||
r = self.client.get(self.url) | r = self.client.get(self.url) | ||||
self.assertEqual(r.status_code, 200) | self.assertEqual(r.status_code, 200) | ||||
def test_it_checks_ownership(self): | def test_it_checks_ownership(self): | ||||
self.bobs_profile.current_project = None | |||||
self.bobs_profile.save() | |||||
self.client.login(username="[email protected]", password="password") | self.client.login(username="[email protected]", password="password") | ||||
r = self.client.get(self.url) | r = self.client.get(self.url) | ||||
self.assertEqual(r.status_code, 404) | self.assertEqual(r.status_code, 404) |
@ -47,9 +47,6 @@ class StatusSingleTestCase(BaseTestCase): | |||||
self.assertFalse("events" in doc) | self.assertFalse("events" in doc) | ||||
def test_it_allows_cross_team_access(self): | def test_it_allows_cross_team_access(self): | ||||
self.bobs_profile.current_project = None | |||||
self.bobs_profile.save() | |||||
self.client.login(username="[email protected]", password="password") | self.client.login(username="[email protected]", password="password") | ||||
r = self.client.get("/checks/%s/status/" % self.check.code) | r = self.client.get("/checks/%s/status/" % self.check.code) | ||||
self.assertEqual(r.status_code, 200) | self.assertEqual(r.status_code, 200) |
@ -48,9 +48,6 @@ class SwitchChannelTestCase(BaseTestCase): | |||||
self.assertEqual(r.status_code, 400) | self.assertEqual(r.status_code, 400) | ||||
def test_it_allows_cross_team_access(self): | def test_it_allows_cross_team_access(self): | ||||
self.bobs_profile.current_project = None | |||||
self.bobs_profile.save() | |||||
self.client.login(username="[email protected]", password="password") | self.client.login(username="[email protected]", password="password") | ||||
r = self.client.post(self.url, {"state": "on"}) | r = self.client.post(self.url, {"state": "on"}) | ||||
self.assertEqual(r.status_code, 200) | self.assertEqual(r.status_code, 200) |
@ -30,11 +30,6 @@ class UpdateNameTestCase(BaseTestCase): | |||||
self.assertEqual(self.check.name, "Bob Was Here") | self.assertEqual(self.check.name, "Bob Was Here") | ||||
def test_it_allows_cross_team_access(self): | def test_it_allows_cross_team_access(self): | ||||
# Bob's current profile is not set | |||||
self.bobs_profile.current_project = None | |||||
self.bobs_profile.save() | |||||
# But this should still work: | |||||
self.client.login(username="[email protected]", password="password") | self.client.login(username="[email protected]", password="password") | ||||
r = self.client.post(self.url, data={"name": "Bob Was Here"}) | r = self.client.post(self.url, data={"name": "Bob Was Here"}) | ||||
self.assertRedirects(r, self.redirect_url) | self.assertRedirects(r, self.redirect_url) | ||||
@ -175,9 +175,6 @@ class UpdateTimeoutTestCase(BaseTestCase): | |||||
self.assertEqual(r.status_code, 405) | self.assertEqual(r.status_code, 405) | ||||
def test_it_allows_cross_team_access(self): | def test_it_allows_cross_team_access(self): | ||||
self.bobs_profile.current_project = None | |||||
self.bobs_profile.save() | |||||
payload = {"kind": "simple", "timeout": 3600, "grace": 60} | payload = {"kind": "simple", "timeout": 3600, "grace": 60} | ||||
self.client.login(username="[email protected]", password="password") | self.client.login(username="[email protected]", password="password") | ||||