diff --git a/hc/accounts/tests/test_project.py b/hc/accounts/tests/test_project.py index 10d6bf0a..60cf6872 100644 --- a/hc/accounts/tests/test_project.py +++ b/hc/accounts/tests/test_project.py @@ -161,6 +161,9 @@ class ProjectTestCase(BaseTestCase): self.assertEqual(r.status_code, 403) def test_it_checks_membership_when_removing_team_member(self): + self.profile.current_project = self.project + self.profile.save() + self.client.login(username="charlie@example.org", password="password") url = "/projects/%s/settings/" % self.charlies_project.code diff --git a/hc/front/tests/test_channel_checks.py b/hc/front/tests/test_channel_checks.py index 534a0f3b..0caf6b32 100644 --- a/hc/front/tests/test_channel_checks.py +++ b/hc/front/tests/test_channel_checks.py @@ -1,4 +1,4 @@ -from hc.api.models import Channel +from hc.api.models import Channel, Check from hc.test import BaseTestCase @@ -9,11 +9,14 @@ class ChannelChecksTestCase(BaseTestCase): self.channel.value = "alice@example.org" self.channel.save() + Check.objects.create(project=self.project, name="Database Backups") + def test_it_works(self): url = "/integrations/%s/checks/" % self.channel.code self.client.login(username="alice@example.org", password="password") r = self.client.get(url) + self.assertContains(r, "Database Backups") self.assertContains(r, "Assign Checks to Integration", status_code=200) def test_team_access_works(self): diff --git a/hc/front/views.py b/hc/front/views.py index 434e1c7a..2e84b765 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -706,7 +706,7 @@ def channel_checks(request, code): channel = _get_channel_for_user(request, code) assigned = set(channel.checks.values_list("code", flat=True).distinct()) - checks = Check.objects.filter(project=request.project).order_by("created") + checks = Check.objects.filter(project=channel.project).order_by("created") ctx = {"checks": checks, "assigned": assigned, "channel": channel} @@ -1147,7 +1147,7 @@ def add_pushbullet(request, code): ctx = { "page": "channels", - "project": request.project, + "project": project, "authorize_url": authorize_url, } diff --git a/hc/test.py b/hc/test.py index ef828a5b..105d7615 100644 --- a/hc/test.py +++ b/hc/test.py @@ -20,7 +20,6 @@ class BaseTestCase(TestCase): self.profile = Profile(user=self.alice) self.profile.sms_limit = 50 - self.profile.current_project = self.project self.profile.save() # Bob is on Alice's team and should have access to her stuff