Add unit tests for pkg/client.ListMinions()
This commit is contained in:
parent
a4b00e33e0
commit
180e9ed493
@ -328,6 +328,7 @@ func (c *Client) ServerVersion() (*version.Info, error) {
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// Lists all the minions in the cluster.
|
||||
func (c *Client) ListMinions() (minionList api.MinionList, err error) {
|
||||
err = c.Get().Path("minions").Do().Into(&minionList)
|
||||
return
|
||||
|
@ -515,3 +515,12 @@ func TestGetServerVersion(t *testing.T) {
|
||||
t.Errorf("expected %v, got %v", e, a)
|
||||
}
|
||||
}
|
||||
|
||||
func TestListMinions(t *testing.T) {
|
||||
c := &testClient{
|
||||
Request: testRequest{Method: "GET", Path: "/minions"},
|
||||
Response: Response{StatusCode: 200, Body: &api.MinionList{JSONBase: api.JSONBase{ID: "minion-1"}}},
|
||||
}
|
||||
response, err := c.Setup().ListMinions()
|
||||
c.Validate(t, &response, err)
|
||||
}
|
||||
|
@ -117,3 +117,8 @@ func (c *Fake) ServerVersion() (*version.Info, error) {
|
||||
versionInfo := version.Get()
|
||||
return &versionInfo, nil
|
||||
}
|
||||
|
||||
func (c *Fake) ListMinions() (api.MinionList, error) {
|
||||
c.Actions = append(c.Actions, FakeAction{Action: "list-minions", Value: nil})
|
||||
return api.MinionList{}, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user