func (s *NiftyServer) SetUp(c *C) {
	auth, err := niftycloud.EnvAuth()
	if err != nil {
		c.Fatal(err.Error())
	}
	s.auth = auth
}
func (s *S) TestEnvAuthAlt(c *C) {
	os.Clearenv()
	os.Setenv("NIFTY_CLOUD_SECRET_KEY", "secret")
	os.Setenv("NIFTY_CLOUD_ACCESS_KEY", "access")
	auth, err := niftycloud.EnvAuth()
	c.Assert(err, IsNil)
	c.Assert(auth, Equals, niftycloud.Auth{SecretKey: "secret", AccessKey: "access"})
}
Exemple #3
0
func (s *LiveSuite) SetUpSuite(c *C) {
	if !Nifty {
		c.Skip("nifty tests not enabled (-nifty flag)")
	}
	auth, err := niftycloud.EnvAuth()
	if err != nil {
		c.Fatal(err.Error())
	}
	s.auth = auth
}
func (s *S) TestEnvAuthNoAccess(c *C) {
	os.Clearenv()
	os.Setenv("NIFTY_CLOUD_SECRET_ACCESS_KEY", "foo")
	_, err := niftycloud.EnvAuth()
	c.Assert(err, ErrorMatches, "NIFTY_CLOUD_ACCESS_KEY_ID or NIFTY_CLOUD_ACCESS_KEY not found in environment")
}
func (s *S) TestEnvAuthNoSecret(c *C) {
	os.Clearenv()
	_, err := niftycloud.EnvAuth()
	c.Assert(err, ErrorMatches, "NIFTY_CLOUD_SECRET_ACCESS_KEY or NIFTY_CLOUD_SECRET_KEY not found in environment")
}