diff mbox series

[error-report-web,1/3] Fix existing tests to establish a know working baseline for future work.

Message ID 20261008150446.74259-1-piotr@qbee.io
State New
Headers show
Series [error-report-web,1/3] Fix existing tests to establish a know working baseline for future work. | expand

Commit Message

Piotr Buliński Oct. 8, 2026, 3:04 p.m. UTC
Signed-off-by: Piotr Buliński <piotr@qbee.io>
---
 Post/test.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/Post/test.py b/Post/test.py
index 5acb68e..15aa4be 100755
--- a/Post/test.py
+++ b/Post/test.py
@@ -2,7 +2,7 @@  import unittest
 import urllib.request, urllib.parse, urllib.error
 import json
 import re
-from django.test import Client
+from django.test import Client, override_settings
 from Post.models import BuildFailure, Build
 
 #Delete the data between tests
@@ -65,6 +65,11 @@  def compare_db_obj_with_payload(self, bf_object):
 
 class SimpleTest(unittest.TestCase):
     def setUp(self):
+        # The test clients submit with HTTP_HOST="testhost", so allow it here
+        # instead of hardcoding a test host into the project settings.
+        override = override_settings(ALLOWED_HOSTS=["testhost"])
+        override.enable()
+        self.addCleanup(override.disable)
         self.client = Client(HTTP_HOST="testhost")
         self.client_0_3 = Client(HTTP_HOST="testhost", HTTP_USER_AGENT="send-error-report/0.3")