mock

package
v0.0.0-...-08a0481 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Contents     map[string]map[string]string
	Latest       string
	DirectoryErr error
	DownloadErr  error
	FileErr      error
	VersionsErr  error
}

Client is a mock implementation of the registry.Client interface.

func (*Client) Archive

func (c *Client) Archive(name, version, path string, out io.Writer) error

Archive writes a zip archive of all mocked contents to out.

func (*Client) Directory

func (c *Client) Directory(name, version, path string) ([]string, []string, error)

Directory lists all the sub-directories and files at the given path in the mocked contents. Package name is ignored.

func (*Client) Download

func (c *Client) Download(name, version string) (string, error)

Download writes the mocked contents to a temporary directory. Package name is ignored.

func (*Client) File

func (c *Client) File(name, version, path string) (string, error)

File reads a file's contents at the given path in the mocked contents. Package name is ignored.

func (*Client) Versions

func (c *Client) Versions(name string) ([]string, string, error)

Versions returns all versions listed in the contents and the specified latest value. Package name is ignored.

Jump to

Keyboard shortcuts

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