From ab3437e61d32a675c74b5660b11b8ebe3ba25649 Mon Sep 17 00:00:00 2001 From: moanos Date: Tue, 5 Nov 2024 07:38:13 +0100 Subject: [PATCH] test: test function to check if site is up --- src/tests/test_admin_tasks.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/tests/test_admin_tasks.py b/src/tests/test_admin_tasks.py index e75b690..d25011d 100644 --- a/src/tests/test_admin_tasks.py +++ b/src/tests/test_admin_tasks.py @@ -2,6 +2,7 @@ from datetime import timedelta from django.utils import timezone from fellchensammlung.tools.admin import get_unchecked_adoption_notices, deactivate_unchecked_adoption_notices +from fellchensammlung.tools.misc import is_404 from django.test import TestCase from model_bakery import baker @@ -48,4 +49,12 @@ class DeactiviationTest(TestCase): self.assertFalse(self.adoption1.is_active) self.assertFalse(self.adoption2.is_active) - self.assertTrue(self.adoption3.is_active) \ No newline at end of file + self.assertTrue(self.adoption3.is_active) + + +class PingTest(TestCase): + def test_is_404(self): + urls = [("https://hyteck.de/maxwell", True), + ("https://hyteck.de", False)] + for url, expected_result in urls: + self.assertEqual(is_404(url), expected_result)