aboutsummaryrefslogtreecommitdiffstats
path: root/marshall_test.go
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2017-06-24 15:27:22 -0400
committerGuillaume Horel <guillaume.horel@gmail.com>2017-06-24 15:27:22 -0400
commit0f836c3c0a0ad3addf943282199a73f1e92d9be9 (patch)
treecf47137ffe8f0d0b2ab292494c8b4cc052abe868 /marshall_test.go
parent05c00b03c4e1503ed7e90b21d3caecc04b35e8d4 (diff)
downloadlastfm-api-0f836c3c0a0ad3addf943282199a73f1e92d9be9.tar.gz
AuthGetToken working
Diffstat (limited to 'marshall_test.go')
-rw-r--r--marshall_test.go25
1 files changed, 22 insertions, 3 deletions
diff --git a/marshall_test.go b/marshall_test.go
index bb57cfd..a916556 100644
--- a/marshall_test.go
+++ b/marshall_test.go
@@ -28,6 +28,27 @@ func TestMarshallXML(t *testing.T) {
os.Stdout.Write(output)
}
+func TestMarshallXMLToken(t *testing.T) {
+ token := Token{Val: randomToken(16)}
+ response := LFMResponse{Status: "ok",
+ Response: token}
+ output, err := xml.MarshalIndent(response, " ", " ")
+ if err != nil {
+ fmt.Printf("error: %v\n", err)
+ }
+ fmt.Printf(xml.Header)
+ os.Stdout.Write(output)
+}
+
+func TestMarshallJSONToken(t *testing.T) {
+ token := Token{Val: randomToken(16)}
+ output, err := json.MarshalIndent(token, " ", " ")
+ if err != nil {
+ fmt.Printf("error: %v\n", err)
+ }
+ os.Stdout.Write(output)
+}
+
func TestMarshallJSON(t *testing.T) {
s := []Scrobble{
Scrobble{Artist: Correctable{Name: "Mumford & Sons"},
@@ -37,9 +58,7 @@ func TestMarshallJSON(t *testing.T) {
}
scrobbles := Scrobbles{Scrobbles: s,
Attrs: Attrs{1, 0}}
- response := LFMResponse{Status: "ok",
- Response: scrobbles}
- output, err := json.MarshalIndent(response, " ", " ")
+ output, err := json.MarshalIndent(scrobbles, " ", " ")
if err != nil {
fmt.Printf("error: %v\n", err)
}