コード例 #1
0
 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')
コード例 #2
0
 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')
コード例 #3
0
ファイル: test_views.py プロジェクト: yogee007/chirpradio
    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')
コード例 #4
0
    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')
コード例 #5
0
 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')
コード例 #6
0
 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')
コード例 #7
0
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>."""
                            )
コード例 #8
0
ファイル: views.py プロジェクト: kumar303/chirpradio
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>."""
        )
コード例 #9
0
 def setUp(self):
     assert memcache.flush_all()
     for c in Config.all():
         c.delete()
コード例 #10
0
 def setUp(self):
     assert memcache.flush_all()
     for c in Config.all():
         c.delete()