(t *testing.T)
| 33 | } |
| 34 | |
| 35 | func TestMonitor(t *testing.T) { |
| 36 | assert := assert.New(t) |
| 37 | cli := &context.ClientContext{ |
| 38 | Namespace: "$unittest", |
| 39 | ID: 1, |
| 40 | RemoteAddr: "127.0.0.1", |
| 41 | DB: &db.DB{Namespace: "$unittest", ID: 0}, |
| 42 | } |
| 43 | serv := &context.ServerContext{} |
| 44 | |
| 45 | out := bytes.NewBuffer(nil) |
| 46 | ctx := &Context{ |
| 47 | Name: "monitor", |
| 48 | Args: nil, |
| 49 | In: nil, |
| 50 | Out: out, |
| 51 | Context: context.New(cli, serv), |
| 52 | } |
| 53 | |
| 54 | Monitor(ctx) |
| 55 | assert.Equal("+OK\r\n", out.String()) |
| 56 | |
| 57 | out.Reset() |
| 58 | ctx = &Context{ |
| 59 | Name: "ping", |
| 60 | Args: nil, |
| 61 | In: nil, |
| 62 | Out: ioutil.Discard, |
| 63 | Context: ctx.Context, |
| 64 | } |
| 65 | feedMonitors(ctx) |
| 66 | assert.Contains(out.String(), "[0 127.0.0.1] ping \r\n") |
| 67 | } |
| 68 | |
| 69 | func TestClient_List(t *testing.T) { |
| 70 | assert := assert.New(t) |
nothing calls this directly
no test coverage detected