From 9bb44fdda9784f01dd955fac57f1dd21e16ff8e9 Mon Sep 17 00:00:00 2001 From: Simeranjeet Sandhu Date: Tue, 22 Oct 2024 14:02:07 -0700 Subject: [PATCH] Overriding Django settings for tests --- app/configurations/tests/test_setup.py | 6 ++++++ app/core/tests/test_setup.py | 6 ++++++ app/users/tests/test_setup.py | 6 ++++++ app/xds_api/tests/test_setup.py | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/app/configurations/tests/test_setup.py b/app/configurations/tests/test_setup.py index 53b3d05..5b0219a 100644 --- a/app/configurations/tests/test_setup.py +++ b/app/configurations/tests/test_setup.py @@ -6,6 +6,8 @@ from rest_framework.test import APITestCase from users.models import XDSUser +from django.test import override_settings + class TestSetUp(APITestCase): """Class with setup and teardown for tests in XDS""" @@ -13,6 +15,10 @@ class TestSetUp(APITestCase): def setUp(self): """Function to set up necessary data for testing""" + settings_manager = override_settings(SECURE_SSL_REDIRECT=False) + settings_manager.enable() + self.addCleanup(settings_manager.disable) + # self.patcher = patch('users.models.email_verification') # self.mock_email_verification = self.patcher.start() diff --git a/app/core/tests/test_setup.py b/app/core/tests/test_setup.py index 3c17ba4..bf1ba11 100644 --- a/app/core/tests/test_setup.py +++ b/app/core/tests/test_setup.py @@ -3,6 +3,8 @@ from openlxp_notifications.models import email from rest_framework.test import APITestCase +from django.test import override_settings + class TestSetUp(APITestCase): """Class with setup and teardown for tests in XDS""" @@ -10,6 +12,10 @@ class TestSetUp(APITestCase): def setUp(self): """Function to set up necessary data for testing""" + settings_manager = override_settings(SECURE_SSL_REDIRECT=False) + settings_manager.enable() + self.addCleanup(settings_manager.disable) + self.patcher = patch('core.signals.trigger_update') self.mock_send_email = self.patcher.start() diff --git a/app/users/tests/test_setup.py b/app/users/tests/test_setup.py index e1538e5..25206b8 100644 --- a/app/users/tests/test_setup.py +++ b/app/users/tests/test_setup.py @@ -6,6 +6,8 @@ from rest_framework.test import APITestCase from users.models import XDSUser +from django.test import override_settings + class TestSetUp(APITestCase): """Class with setup and teardown for tests in XDS""" @@ -13,6 +15,10 @@ class TestSetUp(APITestCase): def setUp(self): """Function to set up necessary data for testing""" + settings_manager = override_settings(SECURE_SSL_REDIRECT=False) + settings_manager.enable() + self.addCleanup(settings_manager.disable) + # self.patcher = patch('users.models.email_verification') # self.mock_email_verification = self.patcher.start() diff --git a/app/xds_api/tests/test_setup.py b/app/xds_api/tests/test_setup.py index ab6ec05..01aa54d 100644 --- a/app/xds_api/tests/test_setup.py +++ b/app/xds_api/tests/test_setup.py @@ -6,6 +6,8 @@ from rest_framework.test import APITestCase from users.models import XDSUser +from django.test import override_settings + class TestSetUp(APITestCase): """Class with setup and teardown for tests in XDS""" @@ -13,6 +15,10 @@ class TestSetUp(APITestCase): def setUp(self): """Function to set up necessary data for testing""" + settings_manager = override_settings(SECURE_SSL_REDIRECT=False) + settings_manager.enable() + self.addCleanup(settings_manager.disable) + # self.patcher = patch('users.models.email_verification') # self.mock_email_verification = self.patcher.start()