Documentation ¶
Index ¶
- Constants
- Variables
- type MockedAlbumsService
- func (m MockedAlbumsService) AddMediaItems(ctx context.Context, albumId string, mediaItemIds []string) error
- func (m MockedAlbumsService) Create(ctx context.Context, title string) (*albums.Album, error)
- func (m MockedAlbumsService) GetById(ctx context.Context, id string) (*albums.Album, error)
- func (m MockedAlbumsService) GetByTitle(ctx context.Context, title string) (*albums.Album, error)
- func (m MockedAlbumsService) List(ctx context.Context) ([]albums.Album, error)
- func (m MockedAlbumsService) RemoveMediaItems(ctx context.Context, albumId string, mediaItemIds []string) error
- type MockedGooglePhotosService
- type MockedMediaItemsService
- func (m MockedMediaItemsService) Create(ctx context.Context, mediaItem media_items.SimpleMediaItem) (media_items.MediaItem, error)
- func (m MockedMediaItemsService) CreateMany(ctx context.Context, mediaItems []media_items.SimpleMediaItem) ([]media_items.MediaItem, error)
- func (m MockedMediaItemsService) CreateManyToAlbum(ctx context.Context, albumId string, mediaItems []media_items.SimpleMediaItem) ([]media_items.MediaItem, error)
- func (m MockedMediaItemsService) CreateToAlbum(ctx context.Context, albumId string, mediaItem media_items.SimpleMediaItem) (media_items.MediaItem, error)
- func (m MockedMediaItemsService) Get(ctx context.Context, mediaItemId string) (*media_items.MediaItem, error)
- func (m MockedMediaItemsService) ListByAlbum(ctx context.Context, albumId string) ([]media_items.MediaItem, error)
- type MockedUploader
Constants ¶
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 ¶
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) GetByTitle ¶ added in v2.1.1
GetByTitle 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 ¶
func (ms MockedGooglePhotosService) URL() string
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
func (m MockedMediaItemsService) Create(ctx context.Context, mediaItem media_items.SimpleMediaItem) (media_items.MediaItem, error)
Create invokes the mock implementation.
func (MockedMediaItemsService) CreateMany ¶ added in v2.1.1
func (m MockedMediaItemsService) CreateMany(ctx context.Context, mediaItems []media_items.SimpleMediaItem) ([]media_items.MediaItem, error)
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
func (m MockedMediaItemsService) CreateToAlbum(ctx context.Context, albumId string, mediaItem media_items.SimpleMediaItem) (media_items.MediaItem, error)
CreateToAlbum invokes the mock implementation.
func (MockedMediaItemsService) Get ¶ added in v2.1.1
func (m MockedMediaItemsService) Get(ctx context.Context, mediaItemId string) (*media_items.MediaItem, error)
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.