reposmocks

package
v0.0.0-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMockAllFunction

func CreateMockAllFunction(err error, rs ...repos.Repo) func() ([]repos.Repo, error)

func CreateMockGetFunction

func CreateMockGetFunction(t *testing.T, spec model.RepoSpec, r repos.Repo, err error) func(s model.RepoSpec) (repos.Repo, error)

func FailTest

func FailTest(t interface {
	Fail()
	Error(args ...any)
}, args ...any)

func MockReposAll

func MockReposAll(t interface {
	Cleanup(func())
}, mock func() ([]repos.Repo, error))

MockReposAll temporarily replaces the All() function with the provided mock for testing purposes. If you use own implementation of t, as opposed to *testing.T, you must make sure that registered cleanup function is called to restore the original All()

func MockReposGet

func MockReposGet(t interface {
	Cleanup(func())
}, mock func(spec model.RepoSpec) (repos.Repo, error))

MockReposGet temporarily replaces the Get() function with the provided mock for testing purposes. If you use own implementation of t, as opposed to *testing.T, you must make sure that registered cleanup function is called to restore the original Get()

Types

This section is empty.

Jump to

Keyboard shortcuts

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