示例#1
0
func TestErrForMissingAccessKey(t *testing.T) {
	delEnv()
	c, err := auth.EnvCredentials()
	if err == nil {
		t.Errorf("Expected an error, got nil.")
	}
	if c != nil {
		t.Errorf("Expected a nil Auth, got %v", c)
	}
	//t.Logf("Got expected error: %v", err)
}
示例#2
0
func TestErrForMissingSecretKey(t *testing.T) {
	setEnv()
	os.Setenv(auth.AWS_SECRET_ACCESS_KEY, "")
	c, err := auth.EnvCredentials()
	if err == nil {
		t.Errorf("Expected an error, got nil.")
	}
	if c != nil {
		t.Errorf("Expected a nil Auth, got %v", c)
	}
	//t.Logf("Got expected error: %v", err)
}
示例#3
0
func TestGetCredentialsFromEnv(t *testing.T) {
	setEnv()
	c, err := auth.EnvCredentials()
	if err != nil {
		t.Errorf("Got unexpected error: %v", err)
	}
	if c.AccessKey != ACCESS_KEY {
		t.Errorf("AccessKey = %v, want %v", c.AccessKey, ACCESS_KEY)
	}
	if c.SecretKey != SECRET_KEY {
		t.Errorf("SecretKey = %v, want %v", c.SecretKey, SECRET_KEY)
	}
}
示例#4
0
func (s *LiveSQSSuite) SetUpSuite(c *C) {
	if !*live {
		c.Skip("-sqs.live not provided, skipping live SQS tests.")
		return
	}
	cred, err := auth.EnvCredentials()
	if err != nil {
		c.Skip("Could not get environment credentials, skipping live tests. Error: " + err.Error())
		return
	}
	s.Credentials = cred
	s.SQS = &sqs.SQS{s.Credentials, &sqs.USWest, sqs.DefaultClientFactory}

	testQueue, _, err := s.createLiveQueue(QUEUE_NAME_PREFIX + "LiveTestQueue_" + time.Now().Format(TIMESTAMP_FMT))
	if err != nil {
		c.Log(err)
		c.Skip("Could not create a test queue in SetUpSuite, skipping live tests")
		return
	}
	s.TestQueue = testQueue
}