Add ExternalInformation core service (not a great name, I know)
This commit is contained in:
@@ -2,6 +2,7 @@ package spotify
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
@@ -28,7 +29,7 @@ var _ = Describe("Client", func() {
|
||||
Body: ioutil.NopCloser(bytes.NewBufferString(`{"access_token": "NEW_ACCESS_TOKEN","token_type": "Bearer","expires_in": 3600}`)),
|
||||
})
|
||||
|
||||
images, err := client.ArtistImages("U2")
|
||||
images, err := client.ArtistImages(context.TODO(), "U2")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(images).To(HaveLen(3))
|
||||
Expect(images[0].Width).To(Equal(640))
|
||||
@@ -50,7 +51,7 @@ var _ = Describe("Client", func() {
|
||||
Body: ioutil.NopCloser(bytes.NewBufferString(`{"access_token": "NEW_ACCESS_TOKEN","token_type": "Bearer","expires_in": 3600}`)),
|
||||
})
|
||||
|
||||
_, err := client.ArtistImages("U2")
|
||||
_, err := client.ArtistImages(context.TODO(), "U2")
|
||||
Expect(err).To(MatchError(ErrNotFound))
|
||||
})
|
||||
|
||||
@@ -62,7 +63,7 @@ var _ = Describe("Client", func() {
|
||||
Body: ioutil.NopCloser(bytes.NewBufferString(`{"error":"invalid_client","error_description":"Invalid client"}`)),
|
||||
})
|
||||
|
||||
_, err := client.ArtistImages("U2")
|
||||
_, err := client.ArtistImages(context.TODO(), "U2")
|
||||
Expect(err).To(MatchError("spotify error(invalid_client): Invalid client"))
|
||||
})
|
||||
})
|
||||
@@ -74,7 +75,7 @@ var _ = Describe("Client", func() {
|
||||
Body: ioutil.NopCloser(bytes.NewBufferString(`{"access_token": "NEW_ACCESS_TOKEN","token_type": "Bearer","expires_in": 3600}`)),
|
||||
})
|
||||
|
||||
token, err := client.authorize()
|
||||
token, err := client.authorize(nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(token).To(Equal("NEW_ACCESS_TOKEN"))
|
||||
auth := httpClient.lastRequest.Header.Get("Authorization")
|
||||
@@ -87,7 +88,7 @@ var _ = Describe("Client", func() {
|
||||
Body: ioutil.NopCloser(bytes.NewBufferString(`{"error":"invalid_client","error_description":"Invalid client"}`)),
|
||||
})
|
||||
|
||||
_, err := client.authorize()
|
||||
_, err := client.authorize(nil)
|
||||
Expect(err).To(MatchError("spotify error(invalid_client): Invalid client"))
|
||||
})
|
||||
|
||||
@@ -97,7 +98,7 @@ var _ = Describe("Client", func() {
|
||||
Body: ioutil.NopCloser(bytes.NewBufferString(`{NOT_VALID}`)),
|
||||
})
|
||||
|
||||
_, err := client.authorize()
|
||||
_, err := client.authorize(nil)
|
||||
Expect(err).To(MatchError("invalid character 'N' looking for beginning of object key string"))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user