|
@@ -33,7 +33,48 @@ class GatewaySettingsTests(TestCase):
|
|
|
with self.assertRaises(AttributeError):
|
|
|
gateway.LoremIpsum
|
|
|
|
|
|
+ def test_setting_public(self):
|
|
|
+ """get_public_settings returns public settings"""
|
|
|
+ test_group = {
|
|
|
+ 'key': 'test_group',
|
|
|
+ 'name': "Test settings",
|
|
|
+ 'description': "Those are test settings.",
|
|
|
+ 'settings': (
|
|
|
+ {
|
|
|
+ 'setting': 'fish_name',
|
|
|
+ 'name': "Fish's name",
|
|
|
+ 'value': "Public Eric",
|
|
|
+ 'field_extra': {
|
|
|
+ 'min_length': 2,
|
|
|
+ 'max_length': 255
|
|
|
+ },
|
|
|
+ 'is_public': True
|
|
|
+ },
|
|
|
+ {
|
|
|
+ 'setting': 'private_fish_name',
|
|
|
+ 'name': "Fish's name",
|
|
|
+ 'value': "Private Eric",
|
|
|
+ 'field_extra': {
|
|
|
+ 'min_length': 2,
|
|
|
+ 'max_length': 255
|
|
|
+ },
|
|
|
+ 'is_public': False
|
|
|
+ },
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ migrate_settings_group(apps, test_group)
|
|
|
+
|
|
|
+ self.assertEqual(gateway.fish_name, 'Public Eric')
|
|
|
+ self.assertEqual(gateway.private_fish_name, 'Private Eric')
|
|
|
+
|
|
|
+ public_settings = gateway.get_public_settings().keys()
|
|
|
+ self.assertIn('fish_name', public_settings)
|
|
|
+ self.assertNotIn('private_fish_name', public_settings)
|
|
|
+
|
|
|
+
|
|
|
def test_setting_lazy(self):
|
|
|
+ """lazy settings work"""
|
|
|
test_group = {
|
|
|
'key': 'test_group',
|
|
|
'name': "Test settings",
|