Files
westfarn b46e192138
Deploy Beta / unit-tests (push) Successful in 21s
Deploy Beta / docker (push) Successful in 26s
Deploy Beta / deploy-beta (push) Successful in 6m25s
Ship College Craft public site and point CI deploys at college_craft.
Replaces template branding with College Craft pages, assets, and copy, and
matches Gitea deploy workflows to the server-infra catalog name and master
branch so beta deploys actually run.

Closes #1
2026-09-02 09:42:43 -05:00

91 lines
2.9 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_public_pages_get(self):
client = Client()
for name in (
"public:home",
"public:about",
"public:services",
"public:testimonials",
"public:contact",
"public:careers",
"public:terms",
):
self.assertEqual(client.get(reverse(name)).status_code, 200, name)
def test_contact_form_creates_lead(self):
client = Client()
response = client.post(
reverse("public:contact"),
{
"first_name": "Pat",
"last_name": "Jones",
"email": "pat@example.com",
"phone": "6305550100",
"interest": "interior",
"message": "Kitchen walls",
},
)
self.assertEqual(response.status_code, 302)
from leads.models import Lead
lead = Lead.objects.get()
self.assertIn("Interior painting", lead.message)
def test_careers_form_creates_lead(self):
client = Client()
response = client.post(
reverse("public:careers"),
{
"first_name": "Sam",
"last_name": "Lee",
"email": "sam@example.com",
"phone": "6305550199",
"positions": ["painter"],
"qualifications": "Five summers of exterior work.",
"start_date": "June",
"drivers_license": "yes",
"has_vehicle": "yes",
},
)
self.assertEqual(response.status_code, 302)
from contacts.models import Contact
from leads.models import Lead
lead = Lead.objects.get()
self.assertEqual(lead.contact.source, Contact.Source.CAREERS)
self.assertIn("Employment application", lead.message)
class DispatchDueTests(TestCase):
def test_quiet_when_nothing_due(self):
out = StringIO()
call_command("dispatch_due", stdout=out)
self.assertEqual(out.getvalue(), "")