MCPcopy Create free account
hub / github.com/distributedio/titan / TestClient_List

Function TestClient_List

command/server_test.go:69–95  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

67}
68
69func TestClient_List(t *testing.T) {
70 assert := assert.New(t)
71 now := time.Now()
72 cli := &context.ClientContext{
73 Namespace: "$unittest",
74 ID: 1,
75 RemoteAddr: "127.0.0.1",
76 DB: &db.DB{Namespace: "$unittest", ID: 0},
77 Created: now,
78 Updated: now,
79 }
80 serv := &context.ServerContext{}
81 serv.Clients.Store(cli.RemoteAddr, cli)
82
83 out := bytes.NewBuffer(nil)
84 ctx := &Context{
85 Name: "client",
86 Args: []string{"list"},
87 In: nil,
88 Out: out,
89 Context: context.New(cli, serv),
90 }
91
92 Client(ctx)
93
94 assert.Contains(out.String(), "id=1 addr=127.0.0.1")
95}

Callers

nothing calls this directly

Calls 3

NewFunction · 0.92
ClientFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected