예제 #1
0
 def test_reload_drop_cache(self):
     defaults = {"TEST": True}
     user_settings = {"TEST": False}
     payment_settings = PaymentSettings(
         user_settings=user_settings, defaults=defaults
     )
     payment_settings.reload()
     self.assertTrue(payment_settings)
예제 #2
0
 def test_transform_dict_to_obj_dict_if_dict_does_not_in_import_dicts(self):
     defaults = {"TEMPLATES": {}}
     user_settings = {"TEMPLATES": {"success": "test.html"}}
     payment_settings = PaymentSettings(
         user_settings=user_settings, defaults=defaults
     )
     self.assertIsInstance(payment_settings.TEMPLATES, ObjDict)
예제 #3
0
 def test_return_value_from_user_settings_if_this_defined(self):
     defaults = {"TEST": True}
     user_settings = {"TEST": False}
     payment_settings = PaymentSettings(
         user_settings=user_settings, defaults=defaults
     )
     self.assertFalse(payment_settings.TEST)
예제 #4
0
 def test_return_value_from_default_if_setting_does_not_defined(self):
     defaults = {"TEST": True}
     user_settings = {}
     payment_settings = PaymentSettings(
         user_settings=user_settings, defaults=defaults
     )
     self.assertTrue(payment_settings.TEST)
예제 #5
0
 def test_transform_dict_to_import_dict_if_dict_in_import_dicts(self):
     defaults = {"MODULES": {}}
     user_settings = {"MODULES": {"payments": "django_pay2"}}
     import_dicts = ["MODULES"]
     payment_settings = PaymentSettings(
         user_settings=user_settings, defaults=defaults, import_dicts=import_dicts
     )
     self.assertIsInstance(payment_settings.MODULES, ImportDict)
예제 #6
0
 def test_raise_error_if_attr_is_not_in_defaults(self):
     defaults = {"TEST": True}
     user_settings = {}
     payment_settings = PaymentSettings(
         user_settings=user_settings, defaults=defaults
     )
     with self.assertRaises(AttributeError):
         payment_settings.NOT_EXIST
예제 #7
0
 def test_merge_user_settings_obj_dict_with_defaults(self):
     defaults = {"MODULES": {"payment": "django_pay2", "tests": "tests"}}
     user_settings = {"MODULES": {"tests": "testproject"}}
     payment_settings = PaymentSettings(
         user_settings=user_settings, defaults=defaults
     )
     self.assertEqual(
         payment_settings.MODULES,
         ObjDict({"payment": "django_pay2", "tests": "testproject"}),
     )
예제 #8
0
 def test_merge_user_settings_import_dict_with_defaults(self):
     defaults = {"MODULES": {"payment": "django_pay2", "tests": "tests"}}
     user_settings = {"MODULES": {"tests": "testproject"}}
     import_dicts = ["MODULES"]
     payment_settings = PaymentSettings(
         user_settings=user_settings, defaults=defaults, import_dicts=import_dicts
     )
     self.assertEqual(
         payment_settings.MODULES,
         ImportDict({"payment": "django_pay2", "tests": "testproject"}),
     )