def test_querybuilderorderby_columnorder(self): qb = QueryBuilder(self._db) qb.From(self._db.Album) qb.order_by(self._db.Album.Title,'ASC') query = qb.preview() expected = "SELECT * FROM Album ORDER BY Album.Title ASC" self.assertEqual(query, expected)
def test_querybuilder_inner_join_deductfields(self): qb = QueryBuilder(self._db) qb.From(self._db.Album) qb.inner_join(self._db.Artist) query = qb.preview() expected = "SELECT * FROM Album INNER JOIN Artist ON Album.ArtistId = Artist.ArtistId " self.assertEqual(query, expected)
def test_where_wherestring_then_appends_string(self): qb = QueryBuilder(self._db) qb.From(self._db.Album).where('1 = 1') query = qb.preview() expected = "SELECT * FROM Album WHERE 1 = 1 " self.assertEqual(query, expected)