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')
def add_artist(): name = ui.get_non_empty_string("enter name ") email = ui.get_email() try: new_artist = db_manager.create_artist(name, email) new_artist.save() except peewee.IntegrityError: ui.message( f"Failed to add! Either the Name: {name}, or the Email: {email} already exist in the database " )
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')
def test_get_email_not_correct_format(self, mock_input): result = ui.get_email() self.assertEqual(result, '*****@*****.**')
def test_get_email_too_many_characters(self, mock_input): result = ui.get_email() self.assertEqual(result, '*****@*****.**')
def test_get_email_no_entry(self, mock_input): result = ui.get_email() self.assertEqual(result, '*****@*****.**') pass
def test_get_email(self, mock_input): result = ui.get_email() self.assertEqual(result, '*****@*****.**')