def test_add_art_with_existing_artist(self): self.remake_tables() Sethany = Artist.create(name='ats1', email_address='*****@*****.**') art1 = Art(artist=1, name='art1', price=0.50) add_art(art1) fetch_art = Art.select().where(Art.name == 'art1') self.assertTrue(art1 == fetch_art[0], msg=f'{art1} is not the same as {fetch_art}')
def show_artists_art(artist_id): artist = Artist.get_or_none(Artist.id == artist_id) query = Art.select().join( Artist, on=(Artist.id == Art.artist)).where(Artist.id == artist.id) return list(query)
def get_art_by_availability(): query = Art.select().where(Art.available == True) return list(query)
def get_all_art(): query = Art.select() return list(query)