package view import ( "bytes" "encoding/json" "net/http" "net/http/httptest" "strings" "testing" "time" "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient" occ "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/clients/operatorchannelclient" oc "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/seats/operatorchannel" "git.novox.be/novox/mesh-delivery/contracts/go/clients/meshdeliveryclient" "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshdelivery" ) const askHeadA = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" // askEntry is a key of the gate's asks as the gate writes it (mesh-sdk go/delivery EncodeAsk, MergeAskKey): the router's ask // whole, under the id its key gives. func askEntry(t *testing.T, group, headline, words string) Entry { t.Helper() heads := []meshdeliveryclient.Head{{Repository: "novox/mesh-delivery", Number: 12, Head: askHeadA}} key, err := meshdeliveryclient.MergeAskKey(group, heads) if err != nil { t.Fatal(err) } a := oc.Ask{ID: meshdeliveryclient.AskID(key), Headline: headline, Explanation: words, Who: occ.Operator, Expires: occ.FormatTime(t0.Add(23 * time.Hour)), OnExpiry: "the merge stays held", Options: []oc.Option{{ID: "approve", Label: "Approve", Does: "merges", Level: occ.Approve, Binds: "sha256:00"}}} v, err := meshdeliveryclient.EncodeAsk(meshdelivery.AsksByMergeGroupHeadsValue{Group: group, Heads: askHeads(heads), Ask: rawAsk(t, a)}) if err != nil { t.Fatal(err) } return Entry{Bucket: AsksBucket, Key: key, Value: v, At: t0} } // answerEntry is the teller's answer to the first asking of the key; answerToAsking to the asking with this router id. The // answer's warrant is `@