Пример #1
0
def add_artwork():
    #Adds anew artwork but checks for artist before adding
    artist_name = ui.get_name('Enter artist name: ')
    artstore.find_artist(artist_name)
    if artist_name:
        art_work = ui.get_name('Enter the artwork name: ')
        art_work = art_work.title()
        price = ui.get_postive_float('Enter the price of the artwork: ')
    try:
        artstore.add_artwork(artist_name, art_work, price)
    except:
        return 'Error'
Пример #2
0
def add_artist():

    #Adds anew artist to the database
    name = ui.get_name('Enter the full name of the artist: ')
    name = name.title()
    email = ui.get_email(f'Enter email for {name}: ')
    try:
        artstore.add_artist(name, email)
    except:
        return ('Error')
Пример #3
0
def add_artist():
    artist_name = ui.get_name()
    # artist query used to insure that the artist is not already in the database to avoid DB unique constraint error
    if artist_query(artist_name).count() == 0:
        email = ui.get_email()
        try:
            create_new_artist(artist_name, email)
        except EntryError:
            raise EntryError('Error adding artist\n')
    else:
        print('Artist already exists\n')
Пример #4
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')
Пример #5
0
 def test_get_name(self, mock_input):
     result = ui.get_name()
     self.assertEqual(result, 'bbb')
Пример #6
0
 def test_get_name_not_alpha_numeric(self, mock_input):
     result = ui.get_name()
     self.assertEqual(result, 'bbb')
Пример #7
0
 def test_get_name_too_many_characters(self, mock_input):
     result = ui.get_name()
     self.assertEqual(result, 'bbb')
Пример #8
0
def available_artwork_of_artist():
    name = ui.get_name('Enter artist name: ')
    art_available = ui.get_artwork_availability()
    artstore.get_artist_available_artwork(name, art_available)
Пример #9
0
def delete_art_work():
    #deletes artwork
    name_of_artwork = ui.get_name(
        'Enter the name of the artwork you want to delete: ')
    name_of_artwork = name_of_artwork.title()
    artstore.delete_artwork(name_of_artwork)
Пример #10
0
def search_by_artist_available():
    name = ui.get_name()
    artist_object = artist_query(name)
    artwork_objects = search_by_available(artist_object)
    utility.artwork_output(artwork_objects)