def test_udpate_settings_mark(self, _get_config_mock): """ Settings must only be updated if EDNX_USE_SIGNAL is present """ config = {} _get_config_mock.return_value = config, "tenant-key" _update_settings("tenant.com") with self.assertRaises(AttributeError): settings.EDNX_TENANT_KEY # pylint: disable=pointless-statement
def test_udpate_settings(self, _get_config_mock): """ Settings must only be updated if EDNX_USE_SIGNAL is present """ config = { "EDNX_USE_SIGNAL": True, } _get_config_mock.return_value = config, "tenant-key" _update_settings("tenant.com") settings.EDNX_TENANT_KEY # pylint: disable=pointless-statement
def test_udpate_settings_with_property(self, _get_config_mock): """ Settings must only be updated if EDNX_USE_SIGNAL is present """ config = { "EDNX_USE_SIGNAL": True, "TEST_PROPERTY": "My value", } _get_config_mock.return_value = config, "tenant-key" _update_settings("tenant.com") self.assertEqual(settings.TEST_PROPERTY, "My value")
def test_udpate_settings_with_dict(self, _get_config_mock): """ Settings must only be updated if EDNX_USE_SIGNAL is present """ from django.conf import settings config = { "EDNX_USE_SIGNAL": True, "TEST_DICT": { "TEST_PROPERTY": "My value", } } _get_config_mock.return_value = config, "tenant-key" _update_settings("tenant.com") self.assertEqual(settings.TEST_DICT.get("TEST_PROPERTY"), "My value")
def test_udpate_settings_with_existing_dict(self, _get_config_mock): """ Settings must only be updated if EDNX_USE_SIGNAL is present """ config = { "EDNX_USE_SIGNAL": True, "TEST_DICT_OVERRIDE_TEST": { "key2": "My value", } } _get_config_mock.return_value = config, "tenant-key" _update_settings("tenant.com") self.assertEqual(settings.TEST_DICT_OVERRIDE_TEST.get("key1"), "Some Value") self.assertEqual(settings.TEST_DICT_OVERRIDE_TEST.get("key2"), "My value")