示例#1
0
  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'日本語')
示例#2
0
    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'日本語')
示例#3
0
 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
示例#4
0
 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')
示例#5
0
 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")
示例#6
0
 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')
示例#7
0
 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")