Пример #1
0
 def testAddSingleValueSeries(self):
     response = self.app.post('/series/add', {"name":"test", "id":"1234",
         "values":json.dumps([{"time":1234, "value":1.0, "id":"5678"}])})
     response.mustcontain("success", "true")
     series = Series.all().filter("name = ", "test").get()
     vals = list(series.values)
     eq_(1, len(vals))
     eq_(1.0, vals[0].value)
     eq_('k5678', vals[0].key().id_or_name())
Пример #2
0
 def testAddValue(self):
     series = Series(name="test")
     series.put()
     response = self.app.post("/value/add", {"value":1234, "seriesKey":str(series.key())})
     response.mustcontain("success", "true")
     series = Series.get(series.key())
     eq_(1, series.values.count())
     eq_(1234, series.values[0].value)
Пример #3
0
 def testDelete(self):
     series = Series(name="test")
     series.put()
     self.app.post("/series/delete", {'key':str(series.key())})
     eq_(None, Series.get(series.key()))
Пример #4
0
 def testAutokeySeries(self):
     response = self.app.post('/series/add', {"name":"test"})
     response.mustcontain("success", "true")
     returnedSeries = json.loads(response.body)['series']
     series = Series.get(Key(returnedSeries["key"]))
     eq_("test", series.name)
Пример #5
0
 def testAddEmptySeries(self):
     response = self.app.post('/series/add', {"name":"test", "id":"1234"})
     response.mustcontain("success", "true")
     series = Series.all().filter("name = ", "test").get()
     eq_('k1234', series.key().id_or_name())