Skip to content

Commit

Permalink
more specs + some changes to models to make specs pass. 5 specs faili…
Browse files Browse the repository at this point in the history
…ng right now
  • Loading branch information
egonSchiele committed Jun 6, 2013
1 parent dc0b6de commit b95d80a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
40 changes: 23 additions & 17 deletions spec/Main.hs
Expand Up @@ -16,42 +16,48 @@ testMethod meth = unsafePerformIO $ do
Left err -> fail err
Right x -> return True

radiohead = "r91318"
me = "s361565"
emi = "l202397"

okcomputer = "a171828"

main = hspec $ do
describe "test methods" $ do
it "getAlbumsByUPC" $ do
testMethod $ getAlbumsByUPC 654979031628 []
it "getAlbumsForArtist" $ do
testMethod $ getAlbumsForArtist "r91318" -- Radiohead
testMethod $ getAlbumsForArtist radiohead
it "getAlbumsForLabel" $ do
testMethod $ getAlbumsForLabel "l202397"
testMethod $ getAlbumsForLabel emi
it "getArtistsForLabel" $ do
testMethod $ getArtistsForLabel "l202397"
testMethod $ getArtistsForLabel emi
it "getTracksByISRC" $ do
testMethod $ getTracksByISRC "" []
it "getTracksForArtist" $ do
testMethod $ getTracksForArtist "r91318"
testMethod $ getTracksForArtist radiohead
it "search" $ do
testMethod $ (search "Radiohead" "Artist" :: Rdio (Either String [Label]))
it "getAlbumsForArtistInCollection" $ do
testMethod $ getAlbumsForArtistInCollection ""
it "getAlbumsForArtistInCollection'" $ do
testMethod $ getAlbumsForArtistInCollection' radiohead (Just me) [] Nothing -- me
it "getAlbumsInCollection'" $ do
testMethod $ getAlbumsInCollection' (Just "") Nothing Nothing Nothing Nothing []
testMethod $ getAlbumsInCollection' (Just me) Nothing Nothing Nothing Nothing []
it "getArtistsInCollection'" $ do
testMethod $ getArtistsInCollection' (Just "") Nothing Nothing Nothing Nothing []
it "getTracksForAlbumInCollection" $ do
testMethod $ getTracksForAlbumInCollection ""
it "getTracksForArtistInCollection" $ do
testMethod $ getTracksForArtistInCollection ""
testMethod $ getArtistsInCollection' (Just me) Nothing Nothing Nothing Nothing []
it "getTracksForAlbumInCollection'" $ do
testMethod $ getTracksForAlbumInCollection' okcomputer (Just me) []
it "getTracksForArtistInCollection'" $ do
testMethod $ getTracksForArtistInCollection' radiohead (Just me) []
it "getTracksInCollection'" $ do
testMethod $ getTracksInCollection' (Just "") Nothing Nothing Nothing Nothing []
testMethod $ getTracksInCollection' (Just me) Nothing Nothing Nothing Nothing []
it "getPlaylists'" $ do
testMethod $ getPlaylists' (Just "") [] Nothing
testMethod $ getPlaylists' (Just me) [] Nothing
it "getUserPlaylists" $ do
testMethod $ getUserPlaylists ""
testMethod $ getUserPlaylists me
it "findUserByEmail" $ do
testMethod $ findUserByEmail "" []
testMethod $ findUserByEmail "bluemangroupie@gmail.com" []
it "findUserByName" $ do
testMethod $ findUserByName "" []
testMethod $ findUserByName "egonschiele" []
it "getNewReleases" $ do
testMethod $ getNewReleases
it "getTopChartArtists" $ do
Expand Down
2 changes: 1 addition & 1 deletion src/Main.hs
Expand Up @@ -8,7 +8,7 @@ key = strip . unsafePerformIO . readFile $ "key"
secret = strip . unsafePerformIO . readFile $ "secret"

main = do
tracks <- runRdio key secret $ search "EMI" "Label" :: IO (Either String [Label])
tracks <- runRdio key secret $ getUserPlaylists "s361565"
case tracks of
Left err -> putStrLn err
Right t -> print t
4 changes: 2 additions & 2 deletions src/Rdioh/Models.hs
Expand Up @@ -233,7 +233,7 @@ data Playlist = Playlist {
plOwnerUrl :: String,
plOwnerKey :: String,
plOwnerIcon :: String,
lastUpdated :: String,
lastUpdated :: Int,
plShortUrl :: String,
plEmbedUrl :: String,
plKey :: String,
Expand Down Expand Up @@ -293,7 +293,7 @@ data User = User {
lastName :: String,
userIcon :: String,
userBaseIcon :: String,
libraryVersion :: String,
libraryVersion :: Int,
userUrl :: String,
gender :: Gender,
followingUrl :: Maybe String,
Expand Down

0 comments on commit b95d80a

Please sign in to comment.