mock_blobclient.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package azureblobreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azureblobreceiver"
  4. import (
  5. bytes "bytes"
  6. context "context"
  7. mock "github.com/stretchr/testify/mock"
  8. )
  9. type mockBlobClient struct {
  10. mock.Mock
  11. }
  12. // ReadBlob provides a mock function with given fields: ctx, containerName, blobName
  13. func (_m *mockBlobClient) readBlob(ctx context.Context, containerName string, blobName string) (*bytes.Buffer, error) {
  14. ret := _m.Called(ctx, containerName, blobName)
  15. var r0 *bytes.Buffer
  16. if rf, ok := ret.Get(0).(func(context.Context, string, string) *bytes.Buffer); ok {
  17. r0 = rf(ctx, containerName, blobName)
  18. } else if ret.Get(0) != nil {
  19. r0 = ret.Get(0).(*bytes.Buffer)
  20. }
  21. var r1 error
  22. if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
  23. r1 = rf(ctx, containerName, blobName)
  24. } else {
  25. r1 = ret.Error(1)
  26. }
  27. return r0, r1
  28. }
  29. func newMockBlobClient() *mockBlobClient {
  30. blobClient := &mockBlobClient{}
  31. blobClient.On("readBlob", mock.Anything, mock.Anything, mock.Anything).Return(&bytes.Buffer{}, nil)
  32. return blobClient
  33. }