35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
import unittest
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
WEBSITE = ROOT / "apps" / "website"
|
|
|
|
|
|
class WebsiteCVTests(unittest.TestCase):
|
|
def test_versioned_cv_is_a_pdf_asset(self):
|
|
pdf = WEBSITE / "Juvenal-Diaz-CV.pdf"
|
|
self.assertGreater(pdf.stat().st_size, 1024)
|
|
self.assertEqual(pdf.read_bytes()[:5], b"%PDF-")
|
|
|
|
def test_cv_actions_use_the_pdf_instead_of_printing_the_web_page(self):
|
|
page = (WEBSITE / "cv.php").read_text()
|
|
self.assertEqual(page.count("asset_url('/Juvenal-Diaz-CV.pdf')"), 2)
|
|
self.assertIn('download="Juvenal-Diaz-CV.pdf"', page)
|
|
self.assertIn('target="_blank"', page)
|
|
self.assertNotIn("window.print()", page)
|
|
|
|
def test_website_deploy_flushes_edge_after_rollout(self):
|
|
pipeline = (ROOT / "lib" / "jeannie" / "pipeline.sh").read_text()
|
|
rollout = pipeline.index(
|
|
"wait_for_deployment_ready website-production php-website-deployment"
|
|
)
|
|
flush = pipeline.index("edge_flush_caches || return 1", rollout)
|
|
next_deployment = pipeline.index('if [[ "${deploy_demos}" == "true" ]]', rollout)
|
|
self.assertLess(rollout, flush)
|
|
self.assertLess(flush, next_deployment)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|