Template
Extract always-on public/portal/UTM plus optional email_sms, directmail, blog, payments, social, and social_ai so new client sites can be bootstrapped from this seed. Refs #1 Refs #2 Co-authored-by: Cursor <cursoragent@cursor.com>
40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
from io import StringIO
|
|
|
|
from django.core.management import call_command
|
|
from django.test import Client, TestCase, override_settings
|
|
from django.urls import reverse
|
|
|
|
|
|
class HealthzTests(TestCase):
|
|
def test_healthz_ok(self):
|
|
response = Client().get("/healthz/")
|
|
self.assertEqual(response.status_code, 200)
|
|
self.assertEqual(response.json()["status"], "ok")
|
|
|
|
|
|
class UnderConstructionTests(TestCase):
|
|
@override_settings(SITE_UNDER_CONSTRUCTION=True)
|
|
def test_home_redirects_when_gated(self):
|
|
response = Client().get("/")
|
|
self.assertEqual(response.status_code, 302)
|
|
self.assertIn("/under-construction", response["Location"])
|
|
|
|
@override_settings(SITE_UNDER_CONSTRUCTION=False)
|
|
def test_home_ok_when_open(self):
|
|
response = Client().get("/")
|
|
self.assertEqual(response.status_code, 200)
|
|
|
|
|
|
class PublicSmokeTests(TestCase):
|
|
def test_about_and_contact_get(self):
|
|
client = Client()
|
|
self.assertEqual(client.get(reverse("public:about")).status_code, 200)
|
|
self.assertEqual(client.get(reverse("public:contact")).status_code, 200)
|
|
|
|
|
|
class DispatchDueTests(TestCase):
|
|
def test_quiet_when_nothing_due(self):
|
|
out = StringIO()
|
|
call_command("dispatch_due", stdout=out)
|
|
self.assertEqual(out.getvalue(), "")
|