github.com/saucelabs/saucectl@v0.175.1/internal/mocks/storage.go (about)

     1  package mocks
     2  
     3  import (
     4  	"errors"
     5  	"io"
     6  
     7  	"github.com/saucelabs/saucectl/internal/storage"
     8  )
     9  
    10  // FakeProjectUploader mock struct
    11  type FakeProjectUploader struct {
    12  	UploadSuccess bool
    13  }
    14  
    15  func (fpu *FakeProjectUploader) UploadStream(filename, description string, reader io.Reader) (storage.Item, error) {
    16  	panic("not implemented")
    17  }
    18  
    19  func (fpu *FakeProjectUploader) Download(id string) (io.ReadCloser, int64, error) {
    20  	panic("not implemented")
    21  }
    22  
    23  func (fpu *FakeProjectUploader) List(opts storage.ListOptions) (storage.List, error) {
    24  	return storage.List{
    25  		Items:     []storage.Item{},
    26  		Truncated: false,
    27  	}, nil
    28  }
    29  
    30  // Upload mock function
    31  func (fpu *FakeProjectUploader) Upload(name, description string) (storage.Item, error) {
    32  	if fpu.UploadSuccess {
    33  		return storage.Item{
    34  			ID: "fake-id",
    35  		}, nil
    36  	}
    37  	return storage.Item{}, errors.New("failed-upload")
    38  }
    39  
    40  // Find mock function
    41  func (fpu *FakeProjectUploader) Find(hash string) (storage.Item, error) {
    42  	return storage.Item{}, nil
    43  }