func (s *NewConnSuite) TestNewConnFromNameNotSetGetsDefault(c *gc.C) { coretesting.MakeSampleJujuHome(c) bootstrapEnv(c, "", defaultConfigStore(c)) conn, err := juju.NewConnFromName("") c.Assert(err, gc.IsNil) defer assertClose(c, conn) c.Assert(conn.Environ.Name(), gc.Equals, coretesting.SampleEnvName) }
func (s *NewConnSuite) TestConnMultipleCloseOk(c *gc.C) { coretesting.MakeSampleJujuHome(c) bootstrapEnv(c, "", defaultConfigStore(c)) // Error return from here is tested in TestNewConnFromNameNotSetGetsDefault. conn, err := juju.NewConnFromName("") c.Assert(err, gc.IsNil) assertClose(c, conn) assertClose(c, conn) assertClose(c, conn) }
func (s *NewConnSuite) TestNewConnFromNameNotDefault(c *gc.C) { coretesting.WriteEnvironments(c, coretesting.MultipleEnvConfig) // The default environment is "erewhemos", so make sure we get what we ask for. const envName = "erewhemos-2" bootstrapEnv(c, envName, defaultConfigStore(c)) conn, err := juju.NewConnFromName(envName) c.Assert(err, gc.IsNil) defer assertClose(c, conn) c.Assert(conn.Environ.Name(), gc.Equals, envName) }