def test_delete_artwork_by_name( self ): # Makes sure artwork is gone after calling the method to delete it self.add_generic_sample_data() artworkDB.delete_artwork('Simplicity Defined') artwork = Artwork.get_or_none(Artwork.name == 'Simplicity Defined') self.assertIsNone(artwork)
def test_change_artwork_availability( self ): # Make sure availability status of artwork is changed correctly self.add_generic_sample_data() artworkDB.change_availability('Simplicity Defined', False) artwork = Artwork.get_or_none(Artwork.name == 'Simplicity Defined', Artwork.available == False) self.assertIsNotNone(artwork)
def test_add_artwork( self ): # Try to retrieve data about an artwork after adding it to the database artworkDB.add_artist('Bob', '*****@*****.**') artworkDB.add_artwork('Bob', 'Air is Empathy', 6600, True) artwork = Artwork.get_or_none(Artwork.name == 'Air is Empathy', Artwork.price == 6600, Artwork.available == True) self.assertIsNotNone(artwork)
def find_artwork(artist_id_in, artwork_name_in): try: searched_artwork = Artwork.get_or_none( Artwork.artist_id == artist_id_in, Artwork.artwork_name == artwork_name_in) return searched_artwork except DatabaseError: #as de: #return de return 'Sorry. There was an error retrieving the artwork.'