Ejemplo n.º 1
0
func (s *loginSuite) assertRemoteEnvironment(c *gc.C, st api.Connection, expected names.EnvironTag) {
	// Look at what the api thinks it has.
	tag, err := st.EnvironTag()
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(tag, gc.Equals, expected)
	// Look at what the api Client thinks it has.
	client := st.Client()

	// EnvironmentUUID looks at the env tag on the api state connection.
	c.Assert(client.EnvironmentUUID(), gc.Equals, expected.Id())

	// EnvironmentInfo calls a remote method that looks up the environment.
	info, err := client.EnvironmentInfo()
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(info.UUID, gc.Equals, expected.Id())
}
Ejemplo n.º 2
0
// envEndpoint returns "/environment/<env-uuid>/<destination>"
func envEndpoint(c *gc.C, apiState api.Connection, destination string) string {
	envTag, err := apiState.EnvironTag()
	c.Assert(err, jc.ErrorIsNil)
	return path.Join("/environment", envTag.Id(), destination)
}