Esempio n. 1
0
def test_search():
    spotify = MusicService('Spotify')
    # Set up dummy search categories
    spotify._get_search_prefix_map = lambda: {
        'stations': 'search:station',
        'shows': 'search:show',
        'hosts': 'search:host',
    }
    categories = spotify.available_search_categories
    assert len(categories) == 3
    assert set(categories) == {'stations', 'shows', 'hosts'}
    with pytest.raises(MusicServiceException) as excinfo:
        spotify.search('badcategory')
    assert "support the 'badcategory' search category" in str(excinfo.value)
Esempio n. 2
0
def test_search():
    spotify = MusicService("Spotify")
    # Set up dummy search categories
    spotify._get_search_prefix_map = lambda: {
        "stations": "search:station",
        "shows": "search:show",
        "hosts": "search:host",
    }
    categories = spotify.available_search_categories
    assert len(categories) == 3
    assert set(categories) == {"stations", "shows", "hosts"}
    with pytest.raises(MusicServiceException) as excinfo:
        spotify.search("badcategory")
    assert "support the 'badcategory' search category" in str(excinfo.value)