pcloudtest

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package pcloudtest provides test helpers for the pcloud package, following the net/http → net/http/httptest convention.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StubAPI

type StubAPI struct {
	ListFolderResult models.ListfolderResponse
	ListFolderErr    error

	DeleteFileErr   error
	DeleteFolderErr error

	RenameFileErr   error
	RenameFolderErr error

	GetFileLinkResult models.GetfileResponse
	GetFileLinkErr    error

	GetZipLinkResult models.GetziplinkResponse
	GetZipLinkErr    error

	// call recorders
	ListFolderCalls   []string
	DeleteFileCalls   []string
	DeleteFolderCalls []string
	RenameFileCalls   [][2]string
	RenameFolderCalls [][2]string
	GetFileLinkCalls  []string
}

StubAPI is a configurable fake that satisfies pcloud.CloudAPI. Set the Err* fields to inject errors and *Result fields to control return payloads. The *Calls slices record arguments for test assertions.

func (*StubAPI) DeleteFile

func (s *StubAPI) DeleteFile(path string) (models.DeletefileResponse, error)

func (*StubAPI) DeleteFolderRecursive

func (s *StubAPI) DeleteFolderRecursive(path string) (models.DeletefolderRecursiveResponse, error)
func (s *StubAPI) GetFileLink(path string) (models.GetfileResponse, error)

func (*StubAPI) GetZipLinkByFolderID

func (s *StubAPI) GetZipLinkByFolderID(folderID int, filename string, forceDownload bool) (models.GetziplinkResponse, error)

func (*StubAPI) ListFolder

func (s *StubAPI) ListFolder(path string, opts pcloud.ListFolderOptions) (models.ListfolderResponse, error)

func (*StubAPI) RenameFile

func (s *StubAPI) RenameFile(src, dst string) (models.RenamefileResponse, error)

func (*StubAPI) RenameFolder

func (s *StubAPI) RenameFolder(src, dst string) (models.RenamefolderResponse, error)

Jump to

Keyboard shortcuts

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