test: fixed tests to use new requestContext
Signed-off-by: SoXX <soxx@fenpa.ws>
This commit is contained in:
parent
6eebc4709a
commit
821462a426
@ -121,14 +121,14 @@ func TestGetFavorites(t *testing.T) {
|
|||||||
httpmock.RegisterResponder("GET", "https://e621.net/favorites.json", jsonResponser)
|
httpmock.RegisterResponder("GET", "https://e621.net/favorites.json", jsonResponser)
|
||||||
|
|
||||||
requestContext := model.RequestContext{
|
requestContext := model.RequestContext{
|
||||||
|
Client: http.Client{},
|
||||||
Host: "https://e621.net",
|
Host: "https://e621.net",
|
||||||
UserAgent: "Go-e621-SDK (@username)",
|
UserAgent: "Go-e621-SDK (@username)",
|
||||||
Username: "memo",
|
Username: "memo",
|
||||||
APIKey: "123456",
|
APIKey: "123456",
|
||||||
}
|
}
|
||||||
|
|
||||||
client := http.Client{}
|
posts, err := GetFavorites(requestContext, map[string]string{})
|
||||||
posts, err := GetFavorites(client, requestContext, map[string]string{})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
return
|
return
|
||||||
|
@ -55,14 +55,14 @@ func TestGetPost(t *testing.T) {
|
|||||||
httpmock.RegisterResponder("GET", "https://e621.net/posts/658415636580.json", jsonResponser)
|
httpmock.RegisterResponder("GET", "https://e621.net/posts/658415636580.json", jsonResponser)
|
||||||
|
|
||||||
requestContext := model.RequestContext{
|
requestContext := model.RequestContext{
|
||||||
|
Client: http.Client{},
|
||||||
Host: "https://e621.net",
|
Host: "https://e621.net",
|
||||||
UserAgent: "Go-e621-SDK (@username)",
|
UserAgent: "Go-e621-SDK (@username)",
|
||||||
Username: "memo",
|
Username: "memo",
|
||||||
APIKey: "123456",
|
APIKey: "123456",
|
||||||
}
|
}
|
||||||
|
|
||||||
client := http.Client{}
|
post, err := GetPost(requestContext, "658415636580")
|
||||||
post, err := GetPost(client, requestContext, "658415636580")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
return
|
return
|
||||||
@ -190,14 +190,14 @@ func TestGetPosts(t *testing.T) {
|
|||||||
httpmock.RegisterResponder("GET", "https://e621.net/posts.json", jsonResponser)
|
httpmock.RegisterResponder("GET", "https://e621.net/posts.json", jsonResponser)
|
||||||
|
|
||||||
requestContext := model.RequestContext{
|
requestContext := model.RequestContext{
|
||||||
|
Client: http.Client{},
|
||||||
Host: "https://e621.net",
|
Host: "https://e621.net",
|
||||||
UserAgent: "Go-e621-SDK (@username)",
|
UserAgent: "Go-e621-SDK (@username)",
|
||||||
Username: "memo",
|
Username: "memo",
|
||||||
APIKey: "123456",
|
APIKey: "123456",
|
||||||
}
|
}
|
||||||
|
|
||||||
client := http.Client{}
|
posts, err := GetPosts(requestContext, map[string]string{})
|
||||||
posts, err := GetPosts(client, requestContext, map[string]string{})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user