Exemplo n.º 1
0
func (s *AmazonServer) SetUp(c *C) {
	auth, err := aws.EnvAuth()
	if err != nil {
		c.Fatal(err.Error())
	}
	s.auth = auth
}
Exemplo n.º 2
0
// Initialize the AWS connection configuration.
func init() {
	auth, err := aws.EnvAuth()
	if err != nil {
		rev.ERROR.Fatalln(`AWS Authorization Required.
Please set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables.`)
	}
	PHOTO_BUCKET = s3.New(auth, aws.USEast).Bucket("photoboard")
}
Exemplo n.º 3
0
func (s *S) TestEnvAuth(c *C) {
	os.Clearenv()
	os.Setenv("AWS_SECRET_ACCESS_KEY", "secret")
	os.Setenv("AWS_ACCESS_KEY_ID", "access")
	auth, err := aws.EnvAuth()
	c.Assert(err, IsNil)
	c.Assert(auth, Equals, aws.Auth{SecretKey: "secret", AccessKey: "access"})
}
Exemplo n.º 4
0
func (s *LiveSuite) SetUpSuite(c *C) {
	if !Amazon {
		c.Skip("amazon tests not enabled (-amazon flag)")
	}
	auth, err := aws.EnvAuth()
	if err != nil {
		c.Fatal(err.Error())
	}
	s.auth = auth
}
Exemplo n.º 5
0
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")
}
Exemplo n.º 6
0
func (s *S) TestEnvAuthNoSecret(c *C) {
	os.Clearenv()
	_, err := aws.EnvAuth()
	c.Assert(err, ErrorMatches, "AWS_SECRET_ACCESS_KEY not found in environment")
}