29 lines
714 B
Go
29 lines
714 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"io"
|
|
"strings"
|
|
"testing"
|
|
|
|
oc "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/seats/operatorchannel"
|
|
)
|
|
|
|
func TestRunNeedsItsCredential(t *testing.T) {
|
|
err := run(context.Background(), func(string) string { return "" }, io.Discard)
|
|
if err == nil || !strings.Contains(err.Error(), "MESH_BROKER_FILE") {
|
|
t.Fatalf("run = %v, want a refusal naming MESH_BROKER_FILE", err)
|
|
}
|
|
}
|
|
|
|
// rawAsk is the router's ask as the JSON a gate's or an assigner's value carries (mesh-sdk keeps it raw, ADR 0627 section 4).
|
|
func rawAsk(t *testing.T, a oc.Ask) json.RawMessage {
|
|
t.Helper()
|
|
b, err := json.Marshal(a)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
return b
|
|
}
|