mocks

package
Version: v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AvailableAlbums is the albums collection.
	AvailableAlbums = []*photoslibrary.Album{
		{
			Id:         "fooId",
			ProductUrl: "fooProductUrl",
			Title:      "fooTitle",
		},
		{
			Id:         "barId",
			ProductUrl: "barProductUrl",
			Title:      "barTitle",
		},
		{
			Id:         "bazId",
			ProductUrl: "bazProductUrl",
			Title:      "bazTitle",
		},
	}

	// ShouldFailAlbum is an album that will make the API fail.
	ShouldFailAlbum = &photoslibrary.Album{
		Id:    "should-fail",
		Title: "should-fail",
	}
)
View Source
var (
	// AvailableMediaItems is the media items collection.
	AvailableMediaItems = []*photoslibrary.MediaItem{
		{
			Id:          "fooId",
			Description: "fooDescription",
			ProductUrl:  "fooProductUrl",
			BaseUrl:     "fooBaseUrl",
			Filename:    "fooFilename",
			MediaMetadata: &photoslibrary.MediaMetadata{
				CreationTime: "2014-10-02T15:01:23.045123456Z",
				Height:       800,
				Width:        600,
			},
		},
		{
			Id:          "barId",
			Description: "barDescription",
			ProductUrl:  "barProductUrl",
			BaseUrl:     "barBaseUrl",
			Filename:    "barFilename",
			MediaMetadata: &photoslibrary.MediaMetadata{
				CreationTime: "2014-10-02T15:01:23.045123456Z",
				Height:       800,
				Width:        600,
			},
		},
		{
			Id:          "bazId",
			Description: "bazDescription",
			ProductUrl:  "bazProductUrl",
			BaseUrl:     "bazBaseUrl",
			Filename:    "bazFilename",
			MediaMetadata: &photoslibrary.MediaMetadata{
				CreationTime: "2014-10-02T15:01:23.045123456Z",
				Height:       800,
				Width:        600,
			},
		},
	}

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

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
t or T : Toggle theme light dark auto
y or Y : Canonical URL