def test_set_multi(self): live_settings.set_multi({ 'setting.1': 'off', 'setting.a': 'on', 'setting.b': 'off', 'setting.c': u'日本語', }) self.assertEqual(live_settings.get('setting.1'), 'off') self.assertEqual(live_settings.get('setting.a'), 'on') self.assertEqual(live_settings.get('setting.b'), 'off') self.assertEqual(live_settings.get('setting.c'), u'日本語')
def _record_ok(self, request): if 'kay.ext.live_settings' in settings.INSTALLED_APPS: from kay.ext.live_settings import live_settings record_ok = live_settings.get("kay.ext.appstats.middleware", "on") request._appstats_record = (record_ok.lower() == "on") return request._appstats_record else: return True
def test_delete(self): value = live_settings.get("setting.1", "default") self.assertEqual(value, "on") live_settings.delete('setting.1') value = live_settings.get("setting.1", "default") self.assertEqual(value, 'default')
def test_get(self): value = live_settings.get("setting.1", "default") self.assertEqual(value, "on") value = live_settings.get("setting.3", "default") self.assertEqual(value, "default")