Ejemplo n.º 1
0
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: &params.CloudSpec{
			"type",
			"name",
			"region",
			"endpoint",
			"identity-endpoint",
			"storage-endpoint",
			&params.CloudCredential{
				AuthType:   "auth-type",
				Attributes: map[string]string{"k": "v"},
			},
		},
	}, {
		Error: &params.Error{
			Code:    params.CodeUnauthorized,
			Message: "permission denied",
		},
	}, {
		Error: &params.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}},
	})
}
Ejemplo n.º 2
0
func (sb *StubBacking) ModelTag() names.ModelTag {
	return names.NewModelTag("dbeef-2f18-4fd2-967d-db9663db7bea")
}