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.
 
 
 
 
 

45 lines
1.5 KiB

from django.test.utils import override_settings
from hc.test import BaseTestCase
@override_settings(PD_VENDOR_KEY="foo")
class AddPdcCompleteTestCase(BaseTestCase):
def setUp(self):
super().setUp()
self.url = "/projects/%s/add_pdc/" % self.project.code
self.url += "XXXXXXXXXXXX/?service_key=123"
def test_it_validates_code(self):
session = self.client.session
session["pd"] = "1234567890AB"
session.save()
self.client.login(username="[email protected]", password="password")
r = self.client.get(self.url)
self.assertEqual(r.status_code, 400)
@override_settings(PD_VENDOR_KEY=None)
def test_it_requires_vendor_key(self):
self.client.login(username="[email protected]", password="password")
r = self.client.get(self.url)
self.assertEqual(r.status_code, 404)
@override_settings(PD_ENABLED=False)
def test_it_requires_pd_enabled(self):
self.client.login(username="[email protected]", password="password")
r = self.client.get(self.url)
self.assertEqual(r.status_code, 404)
def test_it_requires_rw_access(self):
self.bobs_membership.rw = False
self.bobs_membership.save()
session = self.client.session
session["pd"] = "1234567890AB"
session.save()
self.client.login(username="[email protected]", password="password")
r = self.client.get(self.url)
self.assertEqual(r.status_code, 403)