Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CipherStub ¶
type CipherStub struct { // DecryptFunc mocks the Decrypt method. DecryptFunc func(cipherTextFile string, plainTextFile string) error // EncryptFunc mocks the Encrypt method. EncryptFunc func(plainTextFile string, cipherTextFile string) error // contains filtered or unexported fields }
CipherStub is a mock implementation of Cipher.
func TestSomethingThatUsesCipher(t *testing.T) { // make and configure a mocked Cipher mockedCipher := &CipherStub{ DecryptFunc: func(cipherTextFile string, plainTextFile string) error { panic("mock out the Decrypt method") }, EncryptFunc: func(plainTextFile string, cipherTextFile string) error { panic("mock out the Encrypt method") }, } // use mockedCipher in code that requires Cipher // and then make assertions. }
func (*CipherStub) Decrypt ¶
func (mock *CipherStub) Decrypt(cipherTextFile string, plainTextFile string) error
Decrypt calls DecryptFunc.
func (*CipherStub) DecryptCalls ¶
func (mock *CipherStub) DecryptCalls() []struct { CipherTextFile string PlainTextFile string }
DecryptCalls gets all the calls that were made to Decrypt. Check the length with:
len(mockedCipher.DecryptCalls())
func (*CipherStub) Encrypt ¶
func (mock *CipherStub) Encrypt(plainTextFile string, cipherTextFile string) error
Encrypt calls EncryptFunc.
func (*CipherStub) EncryptCalls ¶
func (mock *CipherStub) EncryptCalls() []struct { PlainTextFile string CipherTextFile string }
EncryptCalls gets all the calls that were made to Encrypt. Check the length with:
len(mockedCipher.EncryptCalls())
type HashStub ¶
type HashStub struct { // CalculateFunc mocks the Calculate method. CalculateFunc func(filePath string) (string, error) // VerifyFunc mocks the Verify method. VerifyFunc func(filePath string, expectedChecksum string) error // contains filtered or unexported fields }
HashStub is a mock implementation of Hash.
func TestSomethingThatUsesHash(t *testing.T) { // make and configure a mocked Hash mockedHash := &HashStub{ CalculateFunc: func(filePath string) (string, error) { panic("mock out the Calculate method") }, VerifyFunc: func(filePath string, expectedChecksum string) error { panic("mock out the Verify method") }, } // use mockedHash in code that requires Hash // and then make assertions. }
func (*HashStub) CalculateCalls ¶
CalculateCalls gets all the calls that were made to Calculate. Check the length with:
len(mockedHash.CalculateCalls())
func (*HashStub) VerifyCalls ¶
VerifyCalls gets all the calls that were made to Verify. Check the length with:
len(mockedHash.VerifyCalls())
type StoreStub ¶
type StoreStub struct { // DownloadFileFunc mocks the DownloadFile method. DownloadFileFunc func(remotePath string, localPath string) (string, error) // UploadFileFunc mocks the UploadFile method. UploadFileFunc func(remotePath string, localPath string, checksum string) error // contains filtered or unexported fields }
StoreStub is a mock implementation of Store.
func TestSomethingThatUsesStore(t *testing.T) { // make and configure a mocked Store mockedStore := &StoreStub{ DownloadFileFunc: func(remotePath string, localPath string) (string, error) { panic("mock out the DownloadFile method") }, UploadFileFunc: func(remotePath string, localPath string, checksum string) error { panic("mock out the UploadFile method") }, } // use mockedStore in code that requires Store // and then make assertions. }
func (*StoreStub) DownloadFile ¶
DownloadFile calls DownloadFileFunc.
func (*StoreStub) DownloadFileCalls ¶
DownloadFileCalls gets all the calls that were made to DownloadFile. Check the length with:
len(mockedStore.DownloadFileCalls())
func (*StoreStub) UploadFile ¶
UploadFile calls UploadFileFunc.