Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import os
import unittest
from lyricsgenius.api import Genius
from lyricsgenius.song import Song
from lyricsgenius.artist import Artist
from lyricsgenius.utils import sanitize_filename
# Import client access token from environment variable
client_access_token = os.environ.get("GENIUS_CLIENT_ACCESS_TOKEN", None)
assert client_access_token is not None, "Must declare environment variable: GENIUS_CLIENT_ACCESS_TOKEN"
genius = Genius(client_access_token, sleep_time=0.5)
class TestEndpoints(unittest.TestCase):
@classmethod
def setUpClass(cls):
print("\n---------------------\nSetting up Endpoint tests...\n")
cls.search_term = "Ezra Furman"
cls.song_title_only = "99 Problems"
def test_search_genius_web(self):
# TODO: test more than just a 200 response
msg = "Response was None."
r = genius.search_genius_web(self.search_term)
self.assertTrue(r is not None, msg)