Ejemplo n.º 1
0
        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")
Ejemplo n.º 2
0
        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")
Ejemplo n.º 3
0
        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")
Ejemplo n.º 4
0
        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")
Ejemplo n.º 5
0
        def get(query, *args):

            return get_object(query, *args)