forked from GithubBackups/healthchecks
Reduce usage of request.project cc: #336
This commit is contained in:
parent
318934697f
commit
bb808852d9
@ -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
|
||||
|
@ -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):
|
||||
|
@ -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,
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user