Beispiel #1
0
def add_art():
    artist_name = artist_query(ui.get_name())
    art_name = ui.get_art_name()
    value = ui.get_value()
    # if nothing is returnered from the artist query for the artist name, no attempt will be made to create the art in the db
    if artist_name.count() == 0:
        print('No artist in db\n')
    else:
        try:
            create_art_entry(artist_name, art_name, value)
        except IntegrityError as e:
            raise EntryError('No artist by that name in DB')
Beispiel #2
0
 def test_create_art_non_positive_float_price(self):
     self.clear_tables()
     with self.assertRaises(EntryError):
         artist_db.create_art_entry(artist_db.artist_query('test'), 'new_art', -500)
Beispiel #3
0
 def test_create_art_no_artist(self):
     self.clear_tables()
     with self.assertRaises(EntryError):
         artist_db.create_art_entry(None, 'new_art', 500)
Beispiel #4
0
 def test_art_name_already_exists(self):
     self.clear_tables()
     self.create_test_data()
     with self.assertRaises(EntryError):
         artist_db.create_art_entry(artist_db.artist_query('test'), 'test_art_2', 123)
Beispiel #5
0
 def test_create_art_artist_exists(self):
     self.clear_tables()
     self.create_test_data()
     artist_db.create_art_entry(artist_db.artist_query('test'), 'new_art', 500)
     result = Artworks.select().where(Artworks.artwork_name == 'new_art').get()
     self.assertEqual(result.artwork_name, 'new_art')