def test_get_from_memcache(self): dbconfig['sticky'] = 'stuck' self.assertEqual(dbconfig['sticky'], 'stuck') for c in Config.all(): c.delete() # should be in memcache: self.assertEqual(dbconfig['sticky'], 'stuck')
def test_warmup(self): dbconfig = DBConfig() dbconfig['foo'] = 'bar' assert memcache.flush_all() r = self.client.get('/_ah/warmup') self.assertEquals(r.status_code, 200) self.assertTasksInQueue(1, url='/api/current_playlist') for c in Config.all(): c.delete() self.assertEqual(dbconfig['foo'], 'bar')
def test_load_dbconfig_into_memcache(self): dbconfig['one'] = '1' dbconfig['two'] = '2' dbconfig['three'] = 'three' assert memcache.flush_all() load_dbconfig_into_memcache() for c in Config.all(): c.delete() # should be in memcache: self.assertEqual(dbconfig['one'], '1') self.assertEqual(dbconfig['two'], '2') self.assertEqual(dbconfig['three'], 'three')
def _init_config(request): q = Config.all() if q.count(1) == 0: c = Config() c.varname = "dummy" c.value = "you can safely delete this after creating new var/vals" c.put() return HttpResponse("""Config initialized. You can now add new values in the <a href="/_ah/admin">Datastore admin</a>.""") else: return HttpResponse("""Config does not need initialization. You can edit the config in the <a href="/_ah/admin">Datastore admin</a>.""" )
def _init_config(request): q = Config.all() if q.count(1) == 0: c = Config() c.varname = "dummy" c.value = "you can safely delete this after creating new var/vals" c.put() return HttpResponse( """Config initialized. You can now add new values in the <a href="/_ah/admin">Datastore admin</a>.""" ) else: return HttpResponse( """Config does not need initialization. You can edit the config in the <a href="/_ah/admin">Datastore admin</a>.""" )
def setUp(self): assert memcache.flush_all() for c in Config.all(): c.delete()