@@ -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")
Signed-off-by: Piotr Buliński <piotr@qbee.io> --- Post/test.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)