-
Notifications
You must be signed in to change notification settings - Fork 19
/
my_library_music_videos_test.go
74 lines (65 loc) · 1.99 KB
/
my_library_music_videos_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package applemusic
import (
"context"
"net/http"
"reflect"
"testing"
)
func TestMeService_GetAllLibraryMusicVideos(t *testing.T) {
setup()
defer teardown()
libraryMusicVideosJSON := []byte(`{
"data": [
{
"attributes": {
"albumName": "No Line On the Horizon (Deluxe Edition)",
"artistName": "U2",
"artwork": {
"height": 1200,
"url": "https://example.mzstatic.com/image/thumb/Video/dd/3b/87/mzi.nitgjlfh.jpeg/{w}x{h}bb.jpeg",
"width": 1200
},
"name": "Anton Corbijn's Exclusive Film \"Linear\"",
"trackNumber": 13
},
"href": "/v1/me/library/music-videos/i.xrX5kEvtv0VrNA",
"id": "i.xrX5kEvtv0VrNA",
"type": "library-music-videos"
}
]
}`)
mux.HandleFunc("/v1/me/library/music-videos", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testFormValues(t, r, values{})
w.WriteHeader(http.StatusOK)
_, _ = w.Write(libraryMusicVideosJSON)
})
got, _, err := client.Me.GetAllLibraryMusicVideos(context.Background(), nil)
if err != nil {
t.Errorf("Me.GetAllLibraryMusicVideos returned error: %v", err)
}
want := libraryMusicVideos
if !reflect.DeepEqual(got, want) {
t.Errorf("Me.TestMeService_GetAllLibraryMusicVideos = %+v, want %+v", got, want)
}
}
var libraryMusicVideos = &LibraryMusicVideos{
Data: []LibraryMusicVideo{
{
Attributes: LibraryMusicVideoAttributes{
AlbumName: "No Line On the Horizon (Deluxe Edition)",
ArtistName: "U2",
Artwork: Artwork{
Height: 1200,
URL: "https://example.mzstatic.com/image/thumb/Video/dd/3b/87/mzi.nitgjlfh.jpeg/{w}x{h}bb.jpeg",
Width: 1200,
},
Name: "Anton Corbijn's Exclusive Film \"Linear\"",
TrackNumber: 13,
},
Href: "/v1/me/library/music-videos/i.xrX5kEvtv0VrNA",
Id: "i.xrX5kEvtv0VrNA",
Type: "library-music-videos",
},
},
}