Documentation ¶
Index ¶
- func AssertEqual(t *testing.T, actual interface{}, expected interface{})
- func AssertIsError(t *testing.T, err error)
- func AssertNotError(t *testing.T, err error)
- func DecryptData(data []byte) ([]byte, error)
- func EncryptData(data []byte) ([]byte, error)
- type KmsMock
- type S3Mock
- type SQSMock
- func (sm *SQSMock) ChangeMessageVisibility(cmvi *sqs.ChangeMessageVisibilityInput) (*sqs.ChangeMessageVisibilityOutput, error)
- func (sm *SQSMock) CreateQueueIfNotExists(queueURL *string)
- func (sm *SQSMock) DeleteMessage(dmi *sqs.DeleteMessageInput) (*sqs.DeleteMessageOutput, error)
- func (sm *SQSMock) GetQueueUrl(gqui *sqs.GetQueueUrlInput) (*sqs.GetQueueUrlOutput, error)
- func (sm *SQSMock) ReceiveMessage(rmi *sqs.ReceiveMessageInput) (*sqs.ReceiveMessageOutput, error)
- func (sm *SQSMock) SendMessage(smi *sqs.SendMessageInput) (*sqs.SendMessageOutput, error)
- func (sm *SQSMock) SendMessageBatch(sbi *sqs.SendMessageBatchInput) (*sqs.SendMessageBatchOutput, error)
- func (sm *SQSMock) WaitUntilMessageDeleted(queueURL *string, count int) error
- func (sm *SQSMock) WaitUntilMessagesReceived(queueURL *string, count int) ([]*sqs.Message, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertEqual ¶
AssertEqual asserts if two object are same type and equal value
func AssertIsError ¶
AssertIsError asserts if an error equals nil and and fails the test if its not
func AssertNotError ¶
AssertNotError asserts if an error equals nil or fails the test
func DecryptData ¶
DecryptData is a helper function for decrypting during testing
func EncryptData ¶
EncryptData is a helper function for encrypting during testing
Types ¶
type KmsMock ¶
KmsMock can be used to mock KMS during testing. Set up with a static key
func (*KmsMock) Decrypt ¶
func (k *KmsMock) Decrypt(di *kms.DecryptInput) (*kms.DecryptOutput, error)
Decrypt mock
func (*KmsMock) GenerateDataKey ¶
func (k *KmsMock) GenerateDataKey(gki *kms.GenerateDataKeyInput) (*kms.GenerateDataKeyOutput, error)
GenerateDataKey mock
type S3Mock ¶
type S3Mock struct { s3iface.S3API PutObjectHandler func(*s3.PutObjectInput) (*s3.PutObjectOutput, error) PutObjectHandlerCalledCount int GetObjectHandler func(*s3.GetObjectInput) (*s3.GetObjectOutput, error) GetObjectHandlerCalledCount int }
S3Mock can be used to mock S3 during testing. Inject your own handlers.
func (*S3Mock) GetObject ¶
func (s *S3Mock) GetObject(goi *s3.GetObjectInput) (*s3.GetObjectOutput, error)
GetObject mocks S3 GetObject. Call the handler configured for the S3Mock object.
func (*S3Mock) PutObject ¶
func (s *S3Mock) PutObject(poi *s3.PutObjectInput) (*s3.PutObjectOutput, error)
PutObject mocks S3 PutObject. Call the handler configured for the S3Mock object.
type SQSMock ¶
SQSMock is used to mock SQS during testing. Does not behave exactly as SQS, but should be sufficient for testing and provides a few useful functions when testing. Such as waiting for messages to be deleted, waiting for received messages etc.
func NewSQSMock ¶
NewSQSMock returns a new SQSMock.
func (*SQSMock) ChangeMessageVisibility ¶
func (sm *SQSMock) ChangeMessageVisibility(cmvi *sqs.ChangeMessageVisibilityInput) (*sqs.ChangeMessageVisibilityOutput, error)
ChangeMessageVisibility sends a request to change a messages visibility to the mock.
func (*SQSMock) CreateQueueIfNotExists ¶
CreateQueueIfNotExists will create a queue representation on the mock if one with the same name doesnt already exist.
func (*SQSMock) DeleteMessage ¶
func (sm *SQSMock) DeleteMessage(dmi *sqs.DeleteMessageInput) (*sqs.DeleteMessageOutput, error)
DeleteMessage sends a delete message request to the mock.
func (*SQSMock) GetQueueUrl ¶
func (sm *SQSMock) GetQueueUrl(gqui *sqs.GetQueueUrlInput) (*sqs.GetQueueUrlOutput, error)
GetQueueUrl is primarily implemented so the client can resolve the queues in the mock. Ignore lint output for this function. Cant rename it because its part of an interface which is defined elsewhere.
func (*SQSMock) ReceiveMessage ¶
func (sm *SQSMock) ReceiveMessage(rmi *sqs.ReceiveMessageInput) (*sqs.ReceiveMessageOutput, error)
ReceiveMessage receives a message from the mock.
func (*SQSMock) SendMessage ¶
func (sm *SQSMock) SendMessage(smi *sqs.SendMessageInput) (*sqs.SendMessageOutput, error)
SendMessage sends a message to the mock.
func (*SQSMock) SendMessageBatch ¶
func (sm *SQSMock) SendMessageBatch(sbi *sqs.SendMessageBatchInput) (*sqs.SendMessageBatchOutput, error)
SendMessageBatch sends a batch to the mock.
func (*SQSMock) WaitUntilMessageDeleted ¶
WaitUntilMessageDeleted will wait until count delete message requests are received by the mock. Will time out after a configurable amount of time and return an error.
func (*SQSMock) WaitUntilMessagesReceived ¶
WaitUntilMessagesReceived waits until count messages are received and returns the received messages. Will time out after a configurable amount of time and return an error.