func (payloads) newListAPIClient(cmd *status.ListCommand) (status.ListAPI, error) { apiCaller, err := cmd.NewAPIRoot() if err != nil { return nil, errors.Trace(err) } caller := base.NewFacadeCallerForVersion(apiCaller, payload.ComponentName, 0) listAPI := client.NewPublicClient(&facadeCaller{ FacadeCaller: caller, closeFunc: apiCaller.Close, }) return listAPI, nil }
func (s *publicSuite) TestListOkay(c *gc.C) { s.facade.FacadeCallFn = func(_ string, _, response interface{}) error { typedResponse, ok := response.(*api.EnvListResults) c.Assert(ok, gc.Equals, true) typedResponse.Results = append(typedResponse.Results, s.payload) return nil } pclient := client.NewPublicClient(s.facade) payloads, err := pclient.ListFull("a-tag", "a-application/0") c.Assert(err, jc.ErrorIsNil) expected, _ := api.API2Payload(s.payload) c.Check(payloads, jc.DeepEquals, []payload.FullPayloadInfo{ expected, }) }
func (s *publicSuite) TestListAPI(c *gc.C) { pclient := client.NewPublicClient(s.facade) _, err := pclient.ListFull("a-tag") c.Assert(err, jc.ErrorIsNil) s.stub.CheckCalls(c, []testing.StubCall{{ FuncName: "FacadeCall", Args: []interface{}{ "List", &api.EnvListArgs{ Patterns: []string{"a-tag"}, }, &api.EnvListResults{ Results: nil, }, }, }}) }