Add test for anysigned

This commit is contained in:
Andrew Heberle 2025-09-06 11:41:06 +08:00
parent f5276eb878
commit 03ef3f85cf

View File

@ -118,6 +118,23 @@ func TestGetHost(t *testing.T) {
if host != hosts[0] {
t.Fatalf("%s does not equal %s", host, hosts[0])
}
// check anysigned (uses same issuer and querytoken as previous test)
c.HostSelection = hostselection.AnySigned
// should work with no hosts
c.Hosts = make([]string, 0)
c.QueryInfo = security.QueryInfo
security.QuerySigningKey = key
vals.Set("host", queryToken)
u.RawQuery = vals.Encode()
h = c.NewHandler()
host, err = h.getHost(ctx, u)
if err != nil {
t.Fatalf("Not accepted host %s is in hosts list (err: %s)", hosts[0], err)
}
if host != hosts[0] {
t.Fatalf("%s does not equal %s", host, hosts[0])
}
}
func TestHandler_HandleDownload(t *testing.T) {