Esempio n. 1
0
    def test_render_sql(self):

        from aiorm.orm.query import statements as stmt
        user = sample.User(login='******', firstname='bob')
        query, parameters = stmt.Insert(user).render_sql()
        dummy_dialect = dialect.DummyDialect()
        dummy_dialect.render_insert.assert_called_once_with(user)
Esempio n. 2
0
 def test_where(self):
     from aiorm.orm.query import statements as stmt
     where = stmt.Select(sample.User).where
     self.assertIsInstance(where, stmt.Where)
     dummy_dialect = dialect.DummyDialect()
     condition = Mock()
     query, parameters = where(condition).render_sql(dummy_dialect)
     dummy_dialect.render_where.assert_called_once_with(condition)
Esempio n. 3
0
    def test_render_sql(self):
        from aiorm.orm.query import statements as stmt
        query = Mock()
        condition = Mock()
        where = stmt.Where(query)
        where(condition)

        dummy_dialect = dialect.DummyDialect()
        where.render_sql(dummy_dialect)
        dummy_dialect.render_where.assert_called_once_with(condition)
Esempio n. 4
0
    def test_render_sql(self):
        from aiorm.orm.query import statements as stmt
        query = Mock()
        user = Mock()
        join = stmt.LeftJoin(query)
        join(user)

        dummy_dialect = dialect.DummyDialect()
        join.render_sql(dummy_dialect)
        dummy_dialect.render_left_join.assert_called_once_with(user)
Esempio n. 5
0
    def test_render_sql(self):

        from aiorm.orm.query import statements as stmt
        query, parameters = stmt.Select(sample.User).render_sql()
        dummy_dialect = dialect.DummyDialect()
        dummy_dialect.render_select.assert_called_once_with(sample.User)
Esempio n. 6
0
 def test_render_sql(self):
     from aiorm.orm.query import statements as stmt
     user = sample.User(id=24, login='******', firstname='john')
     query, parameters = stmt.Delete(user).render_sql()
     dummy_dialect = dialect.DummyDialect()
     dummy_dialect.render_delete.assert_called_once_with(user)