This commit is contained in:
Rasmus Lindroth 2022-05-01 17:47:45 +02:00
parent be11f5b013
commit b1b367ca33
45 changed files with 24 additions and 1976 deletions

View file

@ -15,7 +15,6 @@ func TestGetLists(t *testing.T) {
return
}
fmt.Fprintln(w, `[{"id": "1", "title": "foo"}, {"id": "2", "title": "bar"}]`)
return
}))
defer ts.Close()
@ -47,7 +46,6 @@ func TestGetAccountLists(t *testing.T) {
return
}
fmt.Fprintln(w, `[{"id": "1", "title": "foo"}, {"id": "2", "title": "bar"}]`)
return
}))
defer ts.Close()
@ -83,7 +81,6 @@ func TestGetListAccounts(t *testing.T) {
return
}
fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`)
return
}))
defer ts.Close()
@ -119,7 +116,6 @@ func TestGetList(t *testing.T) {
return
}
fmt.Fprintln(w, `{"id": "1", "title": "foo"}`)
return
}))
defer ts.Close()
@ -129,11 +125,11 @@ func TestGetList(t *testing.T) {
ClientSecret: "bar",
AccessToken: "zoo",
})
list, err := client.GetList(context.Background(), "2")
_, err := client.GetList(context.Background(), "2")
if err == nil {
t.Fatalf("should be fail: %v", err)
}
list, err = client.GetList(context.Background(), "1")
list, err := client.GetList(context.Background(), "1")
if err != nil {
t.Fatalf("should not be fail: %v", err)
}
@ -149,7 +145,6 @@ func TestCreateList(t *testing.T) {
return
}
fmt.Fprintln(w, `{"id": "1", "title": "foo"}`)
return
}))
defer ts.Close()
@ -159,11 +154,11 @@ func TestCreateList(t *testing.T) {
ClientSecret: "bar",
AccessToken: "zoo",
})
list, err := client.CreateList(context.Background(), "")
_, err := client.CreateList(context.Background(), "")
if err == nil {
t.Fatalf("should be fail: %v", err)
}
list, err = client.CreateList(context.Background(), "foo")
list, err := client.CreateList(context.Background(), "foo")
if err != nil {
t.Fatalf("should not be fail: %v", err)
}
@ -183,7 +178,6 @@ func TestRenameList(t *testing.T) {
return
}
fmt.Fprintln(w, `{"id": "1", "title": "bar"}`)
return
}))
defer ts.Close()
@ -193,11 +187,11 @@ func TestRenameList(t *testing.T) {
ClientSecret: "bar",
AccessToken: "zoo",
})
list, err := client.RenameList(context.Background(), "2", "bar")
_, err := client.RenameList(context.Background(), "2", "bar")
if err == nil {
t.Fatalf("should be fail: %v", err)
}
list, err = client.RenameList(context.Background(), "1", "bar")
list, err := client.RenameList(context.Background(), "1", "bar")
if err != nil {
t.Fatalf("should not be fail: %v", err)
}
@ -216,7 +210,6 @@ func TestDeleteList(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusMethodNotAllowed)
return
}
return
}))
defer ts.Close()
@ -246,7 +239,6 @@ func TestAddToList(t *testing.T) {
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return
}
return
}))
defer ts.Close()
@ -272,7 +264,6 @@ func TestRemoveFromList(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusMethodNotAllowed)
return
}
return
}))
defer ts.Close()