def test_delete_task(self): t = Task(name="bar") key = t.put() tasks = Task.all().fetch(100) self.assertEquals(1, len(tasks)) Task.delete_task(key) tasks = Task.all().fetch(100) self.assertEquals(0, len(tasks))
def test_to_dict(self): t = Task(name="foo") key = t.put() task = Task.get(key) dic = task.to_dict() self.assertEquals(str(key), dic["key"]) self.assertEquals("foo", dic["name"]) self.assertEquals(False, dic["done"])
def test_update_task(self): t = Task(name="hoge") key = t.put() tasks = Task.all().fetch(100) self.assertEquals(1, len(tasks)) data = { "name": "fuga", } Task.update_task(key, data) actual = Task.all().get() self.assertEquals("fuga", actual.name)