示例#1
0
文件: s3i_test.go 项目: jsimnz/goamz
func (s *AmazonServer) SetUp(c *C) {
	auth, err := aws.EnvAuth()
	if err != nil {
		c.Fatal(err.Error())
	}
	s.auth = auth
}
示例#2
0
文件: aws_test.go 项目: jsimnz/goamz
func (s *S) TestEnvAuthLegacy(c *C) {
	os.Clearenv()
	os.Setenv("EC2_SECRET_KEY", "secret")
	os.Setenv("EC2_ACCESS_KEY", "access")
	auth, err := aws.EnvAuth()
	c.Assert(err, IsNil)
	c.Assert(auth, Equals, aws.Auth{SecretKey: "secret", AccessKey: "access"})
}
示例#3
0
文件: aws_test.go 项目: jsimnz/goamz
func (s *S) TestEnvAuthNoAccess(c *C) {
	os.Clearenv()
	os.Setenv("AWS_SECRET_ACCESS_KEY", "foo")
	_, err := aws.EnvAuth()
	c.Assert(err, ErrorMatches, "AWS_ACCESS_KEY_ID not found in environment")
}
示例#4
0
文件: aws_test.go 项目: jsimnz/goamz
func (s *S) TestEnvAuthNoSecret(c *C) {
	os.Clearenv()
	_, err := aws.EnvAuth()
	c.Assert(err, ErrorMatches, "AWS_SECRET_ACCESS_KEY not found in environment")
}