func (s *CloudSpecSuite) TestCloudSpec(c *gc.C) { otherModelTag := names.NewModelTag(utils.MustNewUUID().String()) machineTag := names.NewMachineTag("42") result, err := s.api.CloudSpec(params.Entities{Entities: []params.Entity{ {coretesting.ModelTag.String()}, {otherModelTag.String()}, {machineTag.String()}, }}) c.Assert(err, jc.ErrorIsNil) c.Assert(result.Results, jc.DeepEquals, []params.CloudSpecResult{{ Result: ¶ms.CloudSpec{ "type", "name", "region", "endpoint", "identity-endpoint", "storage-endpoint", ¶ms.CloudCredential{ AuthType: "auth-type", Attributes: map[string]string{"k": "v"}, }, }, }, { Error: ¶ms.Error{ Code: params.CodeUnauthorized, Message: "permission denied", }, }, { Error: ¶ms.Error{ Message: `"machine-42" is not a valid model tag`, }, }}) s.CheckCalls(c, []testing.StubCall{ {"GetAuthFunc", nil}, {"Auth", []interface{}{coretesting.ModelTag}}, {"CloudSpec", []interface{}{coretesting.ModelTag}}, {"Auth", []interface{}{otherModelTag}}, }) }
func (sb *StubBacking) ModelTag() names.ModelTag { return names.NewModelTag("dbeef-2f18-4fd2-967d-db9663db7bea") }