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.

26 lines
903 B

  1. from django.test.utils import override_settings
  2. from hc.test import BaseTestCase
  3. @override_settings(PD_VENDOR_KEY="foo")
  4. class AddPdcCompleteTestCase(BaseTestCase):
  5. def setUp(self):
  6. super(AddPdcCompleteTestCase, self).setUp()
  7. self.url = "/projects/%s/add_pdc/" % self.project.code
  8. self.url += "XXXXXXXXXXXX/?service_key=123"
  9. def test_it_validates_code(self):
  10. session = self.client.session
  11. session["pd"] = "1234567890AB"
  12. session.save()
  13. self.client.login(username="[email protected]", password="password")
  14. r = self.client.get(self.url)
  15. self.assertEqual(r.status_code, 400)
  16. @override_settings(PD_VENDOR_KEY=None)
  17. def test_it_requires_vendor_key(self):
  18. self.client.login(username="[email protected]", password="password")
  19. r = self.client.get(self.url)
  20. self.assertEqual(r.status_code, 404)