From 13539e305645df992475e7b9ed9b58c7293d854f Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Thu, 30 Aug 2018 12:03:54 +0200 Subject: [PATCH] Fix tests --- helpdesk/tests/helpers.py | 9 +++++++++ quicktest.py | 7 ++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/helpdesk/tests/helpers.py b/helpdesk/tests/helpers.py index e0f53150..0f456bed 100644 --- a/helpdesk/tests/helpers.py +++ b/helpdesk/tests/helpers.py @@ -77,3 +77,12 @@ def create_ticket(**kwargs): HELPDESK_URLCONF = 'helpdesk.urls' + + +def print_response(response, stdout=False): + content = response.content.decode() + if stdout: + print(content) + else: + with open("response.html", "w") as f: # pragma: no cover + f.write(content) # pragma: no cover diff --git a/quicktest.py b/quicktest.py index bae19285..2bdf9747 100644 --- a/quicktest.py +++ b/quicktest.py @@ -60,8 +60,7 @@ class QuickDjangoTest(object): }, }, ] - - SITE_ID = 1 + def __init__(self, *args, **kwargs): self.apps = args @@ -85,7 +84,9 @@ class QuickDjangoTest(object): MIDDLEWARE=self.MIDDLEWARE, ROOT_URLCONF='helpdesk.tests.urls', STATIC_URL='/static/', - TEMPLATES=self.TEMPLATES + LOGIN_URL='/helpdesk/login/', + TEMPLATES=self.TEMPLATES, + SITE_ID=1 ) from django.test.runner import DiscoverRunner