func (s *FacadeSuite) TestAddress(c *gc.C) { var stub jujutesting.Stub apiCaller := apitesting.APICallerFunc(func(objType string, version int, id, request string, arg, result interface{}) error { stub.AddCall(objType+"."+request, arg) c.Check(id, gc.Equals, "") *result.(*params.SSHAddressResults) = params.SSHAddressResults{ Results: []params.SSHAddressResult{{Address: "1.1.1.1"}}, } return nil }) facade := sshclient.NewFacade(apiCaller) expectedArg := []interface{}{params.Entities{[]params.Entity{{ names.NewUnitTag("foo/0").String(), }}}} public, err := facade.PublicAddress("foo/0") c.Assert(err, jc.ErrorIsNil) c.Check(public, gc.Equals, "1.1.1.1") stub.CheckCalls(c, []jujutesting.StubCall{{"SSHClient.PublicAddress", expectedArg}}) stub.ResetCalls() private, err := facade.PrivateAddress("foo/0") c.Assert(err, jc.ErrorIsNil) c.Check(private, gc.Equals, "1.1.1.1") stub.CheckCalls(c, []jujutesting.StubCall{{"SSHClient.PrivateAddress", expectedArg}}) }