def test(database): text = "Test %s" % uuid.uuid4() obj1 = yield from peewee_async.create_object(TestModel, text=text) obj2 = yield from peewee_async.get_object(TestModel, TestModel.id == obj1.id) yield from peewee_async.delete_object(obj2) try: obj3 = yield from peewee_async.get_object( TestModel, TestModel.id == obj1.id) except TestModel.DoesNotExist: obj3 = None self.assertTrue(obj3 is None, "Error, object wasn't deleted")
def test(database): text = "Test %s" % uuid.uuid4() obj1 = yield from peewee_async.create_object( TestModel, text=text) obj2 = yield from peewee_async.get_object( TestModel, TestModel.id == obj1.id) yield from peewee_async.delete_object(obj2) try: obj3 = yield from peewee_async.get_object( TestModel, TestModel.id == obj1.id) except TestModel.DoesNotExist: obj3 = None self.assertTrue(obj3 is None, "Error, object wasn't deleted")
def test(database): text = "Test %s" % uuid.uuid4() obj1 = yield from peewee_async.create_object(TestModel, text=text) obj1.text = "Test update object" yield from peewee_async.update_object(obj1) obj2 = yield from peewee_async.get_object(TestModel, TestModel.id == obj1.id) self.assertEqual(obj2.text, "Test update object")
def test(database): text = "Test %s" % uuid.uuid4() obj1 = yield from peewee_async.create_object( TestModel, text=text) obj1.text = "Test update object" yield from peewee_async.update_object(obj1) obj2 = yield from peewee_async.get_object( TestModel, TestModel.id == obj1.id) self.assertEqual(obj2.text, "Test update object")
def get(query, *args): return get_object(query, *args)