Ejemplo n.º 1
0
    def test_when_artist_not_in_db_but_in_spotify_returns_uri_from_spotify(self):

        uri = get_artist_spotify_uri(self.spotify, "Prince")
        self.assertTrue(self.spotify.search_was_called)
        self.assertEqual("princeyprince", uri)

        prince = Artist.query.first()
        self.assertEqual("Prince", prince.artist_name)
Ejemplo n.º 2
0
    def test_when_artist_exists_in_db_fetches_from_db(self):
        artist = Artist()
        artist.artist_spotify_id = "abc123"
        artist.artist_name = "David Bowie"

        db.session.add(artist)
        db.session.commit()

        uri = get_artist_spotify_uri(self.spotify, "David Bowie")
        self.assertEqual("abc123", uri)
        self.assertFalse(self.spotify.search_was_called)
Ejemplo n.º 3
0
 def test_search_integration_with_spotify_returns_uri(self):
     uri = get_artist_spotify_uri(spotify, "Prince")
     self.assertIsNotNone(uri)
Ejemplo n.º 4
0
 def test_when_artist_not_in_db_and_not_in_spotify_returns_nothing(self):
    
     uri = get_artist_spotify_uri(self.spotify, "David Bowie")
     self.assertIsNone(uri)
     self.assertTrue(self.spotify.search_was_called)