Release v0.2.34
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package emby
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestHideFromResumeUsesDedicatedEmbyEndpoint(t *testing.T) {
|
||||
upstream := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodPost {
|
||||
http.Error(w, "unexpected method: "+r.Method, http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if r.URL.Path != "/Users/user-1/Items/item-2/HideFromResume" {
|
||||
http.Error(w, "unexpected path: "+r.URL.Path, http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if r.URL.Query().Get("Hide") != "true" {
|
||||
http.Error(w, "Hide must be true", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_, _ = w.Write([]byte(`{"Played":false,"PlaybackPositionTicks":0}`))
|
||||
}))
|
||||
defer upstream.Close()
|
||||
|
||||
client := New(upstream.URL, upstream.URL, "MbyATV", time.Second)
|
||||
got, err := client.HideFromResume(
|
||||
context.Background(),
|
||||
Credentials{UserID: "user-1", Token: "token"},
|
||||
"item-2",
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if string(got) != `{"Played":false,"PlaybackPositionTicks":0}` {
|
||||
t.Fatalf("response = %s", got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user