def test_really_delete(self): todo1 = new_todo(self.user, self.project, save=True) self.login() response = self.delete(self.base_url("/" + todo1.key), query_string={"really": "1"}) self.assertStatus(200, response) with self.assertRaises(NotFoundError): ArchivedTodo.get(todo1.key) with self.assertRaises(NotFoundError): Todo.get(todo1.key)
def test_archived_delete(self): todo1 = new_todo(self.user, self.project, save=True) self.login() response = self.delete(self.base_url("/" + todo1.key)) self.assertStatus(200, response) with self.assertRaises(NotFoundError): Todo.get(todo1.key) todo1_again = ArchivedTodo.get(todo1.key) self.assertEquals(todo1.key, todo1_again.key)
def test_delete_todo(self): todo = new_todo(self.user, self.project, save=True) self.login() response, data = self.deleteJSON(self.base_url("/" + todo.key)) self.assertStatus(200, response) with self.assertRaises(NotFoundError): Todo.get(todo.key) response, data = self.deleteJSON(self.base_url("/" + todo.key)) self.assertStatus(404, response)
def test_markdone(self): todo = new_todo(self.user, self.project, save=True) self.login() response, data = self.postJSON(self.base_url("/" + todo.key + "/markdone"), data={"done": True}) self.assertStatus(200, response) self.assertTrue(Todo.get(todo.key).done) response, data = self.postJSON(self.base_url("/" + todo.key + "/markdone"), data={"done": False}) self.assertStatus(200, response) self.assertFalse(Todo.get(todo.key).done)
def new_todo(user, project, **kwargs): save = kwargs.pop("save", False) key = kwargs.pop("key", None) kwargs["parent"] = project if key: t = Todo(key=key, data=kwargs) else: t = Todo(data=kwargs) t.author = user if save: t.save() return t