示例#1
0
文件: aws_test.go 项目: DataDog/goamz
func (s *S) TestGetAuthEnv(c *C) {
	os.Clearenv()
	os.Setenv("AWS_SECRET_ACCESS_KEY", "secret")
	os.Setenv("AWS_ACCESS_KEY_ID", "access")
	auth, err := aws.GetAuth("", "", "", time.Time{})
	c.Assert(err, IsNil)
	c.Assert(auth, Equals, aws.Auth{SecretKey: "secret", AccessKey: "access"})
}
示例#2
0
文件: aws_test.go 项目: DataDog/goamz
func (s *S) TestGetAuthStatic(c *C) {
	exptdate := time.Now().Add(time.Hour)
	auth, err := aws.GetAuth("access", "secret", "token", exptdate)
	c.Assert(err, IsNil)
	c.Assert(auth.AccessKey, Equals, "access")
	c.Assert(auth.SecretKey, Equals, "secret")
	c.Assert(auth.Token(), Equals, "token")
	c.Assert(auth.Expiration(), Equals, exptdate)
}