Пример #1
0
 def test_get_gm_track_artists_ampersand(self):
     """
     Given a GM Track with an artist string containing multiple artists
     Should return a list of those artists
     """
     gm_track = gmusic.GMusicTrack(title='Zhao Hua',
                                   artist='HVAD & Pan Daijing')
     expected = ['HVAD', 'Pan Daijing']
     actual = gmspotify.get_gm_track_artists(gm_track)
     self.assertEqual(actual, expected)
Пример #2
0
 def test_get_gm_track_artists_ft_1(self):
     """
     Given a GM Track with a title featuring an artist
     Should append that artist to main artist
     """
     gm_track = gmusic.GMusicTrack(title='Stretch Deep (feat. Eve Essex)',
                                   artist='James K')
     expected = ['Eve Essex', 'James K']
     actual = gmspotify.get_gm_track_artists(gm_track)
     self.assertEqual(actual, expected)
Пример #3
0
 def test_get_gm_track_artists_ft_2(self):
     """
     Given a GM Track with a title featuring an artist
     Should append that artist to main artist
     """
     gm_track = gmusic.GMusicTrack(title='MMXXX (ft Moor Mother)',
                                   artist='Earthmother')
     expected = ['Earthmother', 'Moor Mother']
     actual = gmspotify.get_gm_track_artists(gm_track)
     self.assertEqual(actual, expected)
Пример #4
0
    def test_initial_sp_query(self):
        sp_api = self.get_mock_sp_api()
        gm_album = gmusic.GMusicAlbum(id='B5chesvwefhpatizcpdwavg65iu',
                                      title='Grafts',
                                      album_artist='Kara-Lis Coverdale',
                                      year='2017',
                                      tracks={
                                          1: {
                                              1:
                                              gmusic.GMusicTrack(
                                                  title='Grafts',
                                                  artist='Kara-Lis Coverdale')
                                          }
                                      })

        gmspotify.query_gm_album_in_spotify(sp_api=sp_api, gm_album=gm_album)
        sp_api.client.search.assert_called_once_with(
            q='album:Grafts artist:Kara-Lis Coverdale year:2017', type='album')
Пример #5
0
import unittest
import json

import gmspotify
import spotify
import gmusic
import munch
from unittest.mock import MagicMock
from test_helpers import construct_sp_track

sp_track_1 = construct_sp_track(['James K', 'Eve Essex'], 1,
                                'Stretch Deep - feat. Eve Essex', 12)

gm_track_1 = gmusic.GMusicTrack(title='Stretch Deep (feat. Eve Essex)',
                                artist='James K')

sp_track_2 = construct_sp_track(['HVAD', 'Pan Daijing'], 1, 'Zhao Hua', 16)

gm_track_2 = gmusic.GMusicTrack(title='Zhao Hua', artist='HVAD & Pan Daijing')


class TestGetSTrackArtists(unittest.TestCase):
    def test_get_s_track_artists(self):
        """
        Given a s_track record with multiple artists
        Should return a list of those artists
        """
        sp_track = spotify.SpAlbumTrack(
            munch.munchify({
                'artists': [{
                    'external_urls': {