示例#1
0
func (s *NiftyServer) SetUp(c *C) {
	auth, err := niftycloud.EnvAuth()
	if err != nil {
		c.Fatal(err.Error())
	}
	s.auth = auth
}
示例#2
0
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"})
}
示例#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
}
示例#4
0
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")
}
示例#5
0
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")
}