28 lines
621 B
Go
28 lines
621 B
Go
package emby
|
|
|
|
import (
|
|
"net/url"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestSubtitleURLUsesCanonicalVTTEndpoint(t *testing.T) {
|
|
client := New("http://emby:8096", "https://emby.example", "MbyATV", "MbyGateway", time.Second)
|
|
got := client.SubtitleURL(
|
|
Credentials{Token: "a b"},
|
|
"item id",
|
|
"source/id",
|
|
4,
|
|
)
|
|
parsed, err := url.Parse(got)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if parsed.EscapedPath() != "/Videos/item%20id/source%2Fid/Subtitles/4/Stream.vtt" {
|
|
t.Fatalf("unexpected subtitle path %q", parsed.EscapedPath())
|
|
}
|
|
if parsed.Query().Get("api_key") != "a b" {
|
|
t.Fatalf("subtitle token was not preserved")
|
|
}
|
|
}
|