mocks

package
v2.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// AvailableMediaItems is the number of media items in the fake collection. It should be bigger than `maxItemsPerPage`.
	AvailableMediaItems = 150
	// AvailableAlbums is the number of media items in the fake collection. It should be bigger than `maxItemsPerPage`.
	AvailableAlbums = 75

	// ShouldMakeAPIFailMediaItem will make API fail.
	ShouldMakeAPIFailMediaItem = "should-make-API-fail"
	// ShouldReturnEmptyMediaItem will return an empty media item
	ShouldReturnEmptyMediaItem = "should-return-empty-media-item"
)

Variables

View Source
var (
	// ShouldFailAlbum is an album that will make the API fail.
	ShouldFailAlbum = &photoslibrary.Album{
		Id:    "should-fail",
		Title: "should-fail",
	}
)

Functions

This section is empty.

Types

type MockedAlbumsService added in v2.1.1

type MockedAlbumsService struct {
	AddMediaItemsFn    func(ctx context.Context, albumId string, mediaItemIds []string) error
	RemoveMediaItemsFn func(ctx context.Context, albumId string, mediaItemIds []string) error
	CreateFn           func(ctx context.Context, title string) (*albums.Album, error)
	GetByIdFn          func(ctx context.Context, id string) (*albums.Album, error)
	GetByTitleFn       func(ctx context.Context, title string) (*albums.Album, error)
	ListFn             func(ctx context.Context) ([]albums.Album, error)
}

MockedAlbumsService mocks the albums service.

func (MockedAlbumsService) AddMediaItems added in v2.1.1

func (m MockedAlbumsService) AddMediaItems(ctx context.Context, albumId string, mediaItemIds []string) error

AddMediaItems invokes the mock implementation.

func (MockedAlbumsService) Create added in v2.1.1

func (m MockedAlbumsService) Create(ctx context.Context, title string) (*albums.Album, error)

Create invokes the mock implementation.

func (MockedAlbumsService) GetById added in v2.1.1

func (m MockedAlbumsService) GetById(ctx context.Context, id string) (*albums.Album, error)

GetById invokes the mock implementation.

func (MockedAlbumsService) GetByTitle added in v2.1.1

func (m MockedAlbumsService) GetByTitle(ctx context.Context, title string) (*albums.Album, error)

GetByTitle invokes the mock implementation.

func (MockedAlbumsService) List added in v2.1.1

List invokes the mock implementation.

func (MockedAlbumsService) RemoveMediaItems added in v2.1.1

func (m MockedAlbumsService) RemoveMediaItems(ctx context.Context, albumId string, mediaItemIds []string) error

RemoveMediaItems invokes the mock implementation.

type MockedGooglePhotosService

type MockedGooglePhotosService struct {
	// contains filtered or unexported fields
}

MockedGooglePhotosService mocks the Google Photos service.

func NewMockedGooglePhotosService

func NewMockedGooglePhotosService() *MockedGooglePhotosService

NewMockedGooglePhotosService returns a mocked Google Photos service.

func (MockedGooglePhotosService) Close

func (ms MockedGooglePhotosService) Close()

Close closes the HTTP server.

func (MockedGooglePhotosService) URL

URL returns the HTTP server url.

type MockedMediaItemsService added in v2.1.1

type MockedMediaItemsService struct {
	CreateFn            func(ctx context.Context, mediaItem media_items.SimpleMediaItem) (media_items.MediaItem, error)
	CreateManyFn        func(ctx context.Context, mediaItems []media_items.SimpleMediaItem) ([]media_items.MediaItem, error)
	CreateToAlbumFn     func(ctx context.Context, albumId string, mediaItem media_items.SimpleMediaItem) (media_items.MediaItem, error)
	CreateManyToAlbumFn func(ctx context.Context, albumId string, mediaItems []media_items.SimpleMediaItem) ([]media_items.MediaItem, error)
	GetFn               func(ctx context.Context, mediaItemId string) (*media_items.MediaItem, error)
	ListByAlbumFn       func(ctx context.Context, albumId string) ([]media_items.MediaItem, error)
}

MockedMediaItemsService mocks the media items service.

func (MockedMediaItemsService) Create added in v2.1.1

Create invokes the mock implementation.

func (MockedMediaItemsService) CreateMany added in v2.1.1

CreateMany invokes the mock implementation.

func (MockedMediaItemsService) CreateManyToAlbum added in v2.1.1

func (m MockedMediaItemsService) CreateManyToAlbum(ctx context.Context, albumId string, mediaItems []media_items.SimpleMediaItem) ([]media_items.MediaItem, error)

CreateManyToAlbum invokes the mock implementation.

func (MockedMediaItemsService) CreateToAlbum added in v2.1.1

CreateToAlbum invokes the mock implementation.

func (MockedMediaItemsService) Get added in v2.1.1

Get invokes the mock implementation.

func (MockedMediaItemsService) ListByAlbum added in v2.1.1

func (m MockedMediaItemsService) ListByAlbum(ctx context.Context, albumId string) ([]media_items.MediaItem, error)

ListByAlbum invokes the mock implementation.

type MockedUploader added in v2.1.1

type MockedUploader struct {
	UploadFileFn func(ctx context.Context, filePath string) (uploadToken string, err error)
}

MockedUploader mocks an uploader.

func (MockedUploader) UploadFile added in v2.1.1

func (m MockedUploader) UploadFile(ctx context.Context, filePath string) (uploadToken string, err error)

UploadFile invokes the mock implementation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL