/
root_test.go
37 lines (31 loc) · 980 Bytes
/
root_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package expand
import (
"testing"
"github.com/ory/x/cmdx"
"github.com/stretchr/testify/assert"
"github.com/ory/keto/cmd/client"
"github.com/ory/keto/internal/namespace"
)
func TestExpandCommand(t *testing.T) {
nspace := &namespace.Namespace{Name: t.Name()}
ts := client.NewTestServer(t, client.ReadServer, []*namespace.Namespace{nspace}, NewExpandCmd)
defer ts.Shutdown(t)
t.Run("case=unknown tuple", func(t *testing.T) {
t.Run("format=JSON", func(t *testing.T) {
stdOut := ts.Cmd.ExecNoErr(t,
"access", nspace.Name, "object",
"--"+cmdx.FlagFormat, string(cmdx.FormatJSON),
"--insecure-skip-hostname-verification=true",
)
assert.Equal(t, "null\n", stdOut)
})
t.Run("format=default", func(t *testing.T) {
stdOut := ts.Cmd.ExecNoErr(t,
"access", nspace.Name,
"object", "--"+cmdx.FlagFormat, string(cmdx.FormatDefault),
"--insecure-skip-hostname-verification=true",
)
assert.Contains(t, stdOut, "empty tree")
})
})
}