<s> from os . path import join <EOL> import os <EOL> from django . test import TestCase <EOL> from wham . httmock import HTTMock <EOL> from wham . apis . spotify . models import SpotifyTrack , SpotifyArtist <EOL> from wham . tests import build_httmock_functions <EOL> APP_DIR = os . path . dirname ( __file__ ) <EOL> MOCK_RESPONSES_DIR = join ( APP_DIR , '<STR_LIT>' ) <EOL> mock_functions = build_httmock_functions ( MOCK_RESPONSES_DIR ) <EOL> class TestCase ( TestCase ) : <EOL> def test_spotify ( self ) : <EOL> with HTTMock ( * mock_functions ) : <EOL> track = SpotifyTrack . objects . get ( pk = '<STR_LIT>' ) <EOL> self . assertEquals ( track . name , '<STR_LIT>' ) <EOL> tracks = SpotifyTrack . objects . all ( wham_use_cache = True ) <EOL> self . assertEqual ( tracks . count ( ) , <NUM_LIT:1> ) <EOL> artists = SpotifyArtist . objects . all ( wham_use_cache = True ) <EOL> self . assertEqual ( artists . count ( ) , <NUM_LIT:1> ) <EOL> artist = artists [ <NUM_LIT:0> ] <EOL> self . assertEqual ( artist . name , '<STR_LIT>' ) <EOL> albums = artist . albums . all ( ) <EOL> self . assertEqual ( albums . count ( ) , <NUM_LIT:20> ) <EOL> albums = artist . albums . all ( ) <EOL> self . assertEqual ( albums . count ( ) , <NUM_LIT:20> ) <EOL> albums = artist . albums . all ( wham_depth = <NUM_LIT:2> ) <EOL> self . assertIsNotNone ( albums [ <NUM_LIT:0> ] . popularity ) <EOL> artists = SpotifyArtist . objects . filter ( name__icontains = '<STR_LIT>' ) <EOL> self . assertEqual ( artists [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> artists = SpotifyArtist . objects . filter ( name__icontains = '<STR_LIT>' ) </s>
