mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fixes for unit tests (#4441)
(cherry picked from commit 0bbba26e6331b05696cadfb21e36617de62d999c)
This commit is contained in:
parent
31f4045465
commit
2d7f9e3a4c
@ -831,15 +831,15 @@ class TestSettings(helpers.InvenTreeTestCase):
|
||||
self.assertEqual(config.get_setting(TEST_ENV_NAME, None), '321')
|
||||
|
||||
# test typecasting to dict - None should be mapped to empty dict
|
||||
self.assertEqual(config.get_setting(TEST_ENV_NAME, None, None), {})
|
||||
self.assertEqual(config.get_setting(TEST_ENV_NAME, None, None, typecast=dict), {})
|
||||
|
||||
# test typecasting to dict - valid JSON string should be mapped to corresponding dict
|
||||
with self.in_env_context({TEST_ENV_NAME: '{"a": 1}'}):
|
||||
self.assertEqual(config.get_setting(TEST_ENV_NAME, None), {"a": 1})
|
||||
self.assertEqual(config.get_setting(TEST_ENV_NAME, None, typecast=dict), {"a": 1})
|
||||
|
||||
# test typecasting to dict - invalid JSON string should be mapped to empty dict
|
||||
with self.in_env_context({TEST_ENV_NAME: "{'a': 1}"}):
|
||||
self.assertEqual(config.get_setting(TEST_ENV_NAME, None), {})
|
||||
self.assertEqual(config.get_setting(TEST_ENV_NAME, None, typecast=dict), {})
|
||||
|
||||
|
||||
class TestInstanceName(helpers.InvenTreeTestCase):
|
||||
|
Loading…
Reference in New Issue
Block a user