Documentation
¶
Overview ¶
Package encryptionmock provides mock implementations of the encryption package's interfaces. Both the hand-written testify-based MockImpl and the moq-generated EncryptorDecryptorMock live here during the testify → moq migration. New test code should prefer EncryptorDecryptorMock.
Index ¶
- type EncryptorDecryptorMock
- func (mock *EncryptorDecryptorMock) Decrypt(ctx context.Context, content string) (string, error)
- func (mock *EncryptorDecryptorMock) DecryptCalls() []struct{ ... }
- func (mock *EncryptorDecryptorMock) Encrypt(ctx context.Context, content string) (string, error)
- func (mock *EncryptorDecryptorMock) EncryptCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EncryptorDecryptorMock ¶
type EncryptorDecryptorMock struct {
// DecryptFunc mocks the Decrypt method.
DecryptFunc func(ctx context.Context, content string) (string, error)
// EncryptFunc mocks the Encrypt method.
EncryptFunc func(ctx context.Context, content string) (string, error)
// contains filtered or unexported fields
}
EncryptorDecryptorMock is a mock implementation of encryption.EncryptorDecryptor.
func TestSomethingThatUsesEncryptorDecryptor(t *testing.T) {
// make and configure a mocked encryption.EncryptorDecryptor
mockedEncryptorDecryptor := &EncryptorDecryptorMock{
DecryptFunc: func(ctx context.Context, content string) (string, error) {
panic("mock out the Decrypt method")
},
EncryptFunc: func(ctx context.Context, content string) (string, error) {
panic("mock out the Encrypt method")
},
}
// use mockedEncryptorDecryptor in code that requires encryption.EncryptorDecryptor
// and then make assertions.
}
func (*EncryptorDecryptorMock) DecryptCalls ¶
func (mock *EncryptorDecryptorMock) DecryptCalls() []struct { Ctx context.Context Content string }
DecryptCalls gets all the calls that were made to Decrypt. Check the length with:
len(mockedEncryptorDecryptor.DecryptCalls())
func (*EncryptorDecryptorMock) EncryptCalls ¶
func (mock *EncryptorDecryptorMock) EncryptCalls() []struct { Ctx context.Context Content string }
EncryptCalls gets all the calls that were made to Encrypt. Check the length with:
len(mockedEncryptorDecryptor.EncryptCalls())
Click to show internal directories.
Click to hide internal directories.