tests

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: MIT

SPDX-License-Identifier: MIT

Index

Constants

This section is empty.

Variables

View Source
var RootUser *format.User = &format.User{
	UserName: "root",
}
View Source
var TestAssetsProviderOptions = ProviderOptions{
	Retry: true,
	CmpOptions: cmp.Options{
		cmp.FilterPath(
			func(path cmp.Path) bool {
				return path.Last().String() == ".DownloadFunc"
			},
			cmp.Ignore()),
	},
}
View Source
var TestCommentProviderOptions = ProviderOptions{Retry: false}
View Source
var TestIssueProviderOptions = ProviderOptions{Retry: false}
View Source
var TestLabelProviderOptions = ProviderOptions{Retry: false}
View Source
var TestMilestonesProviderOptions = ProviderOptions{Retry: false}
View Source
var TestProjectProviderOptions = ProviderOptions{Retry: false}
View Source
var TestPullRequestsProviderOptions = ProviderOptions{
	CmpOptions: cmp.Options{
		cmp.FilterPath(
			func(path cmp.Path) bool {
				return path.Last().String() == ".FetchFunc"
			},
			cmp.Ignore()),
	},
}
View Source
var TestReleasesProviderOptions = ProviderOptions{Retry: false}
View Source
var TestRepositoryProviderOptions = ProviderOptions{
	Retry:        true,
	NoDelete:     true,
	NoComparePut: true,
	CmpOptions: cmp.Options{
		cmp.FilterPath(
			func(path cmp.Path) bool {
				last := path.Last().String()
				return last == ".FetchFunc"
			},
			cmp.Ignore()),
	},
}
View Source
var TestReviewProviderOptions = ProviderOptions{Retry: false}
View Source
var TestTopicProviderOptions = ProviderOptions{Retry: false}
View Source
var TestUsersProviderOptions = ProviderOptions{Retry: false}

Functions

func ProviderMethods

func ProviderMethods(
	t assert.TestingT,
	o ProviderOptions,
	provider common.ProviderInterface,
	fixture format.Interface,
	modifiedFixture format.Interface,
	parents ...common.ContainerObjectInterface,
)

func TestAssets

func TestAssets(gi ForgeTestInterface, opts ProviderOptions)

func TestComment

func TestComment(gi ForgeTestInterface, opts ProviderOptions)

func TestForgeMethods

func TestForgeMethods(t *testing.T, newTestForge func(TestingT) ForgeTestInterface)

func TestIssue

func TestIssue(gi ForgeTestInterface, opts ProviderOptions)

func TestLabel

func TestLabel(gi ForgeTestInterface, opts ProviderOptions)

func TestMilestones

func TestMilestones(gi ForgeTestInterface, opts ProviderOptions)

func TestProject

func TestProject(gi ForgeTestInterface, opts ProviderOptions)

func TestPullRequests

func TestPullRequests(gi ForgeTestInterface, opts ProviderOptions)

func TestReleases

func TestReleases(gi ForgeTestInterface, opts ProviderOptions)

func TestRepository

func TestRepository(gi ForgeTestInterface, opts ProviderOptions)

func TestReview

func TestReview(gi ForgeTestInterface, opts ProviderOptions)

func TestTopic

func TestTopic(gi ForgeTestInterface, opts ProviderOptions)

func TestUsers

func TestUsers(gi ForgeTestInterface, opts ProviderOptions)

func ToFromFormat

func ToFromFormat[
	Bean any,
	BeanFormat any,

	BeanPtr BeanConstraint[Bean, BeanFormat, BeanFormatPtr],
	BeanFormatPtr BeanFormatConstraint[BeanFormat],
](t TestingT, b BeanPtr,
)

Types

type BeanConstraint

type BeanConstraint[Bean any, BeanFormat any, BeanFormatPtr any] interface {
	*Bean
	ToFormat() BeanFormatPtr
	FromFormat(BeanFormatPtr)
}

type BeanFormatConstraint

type BeanFormatConstraint[BeanFormat any] interface {
	*BeanFormat
}

type Creator

type Creator struct {
	// contains filtered or unexported fields
}

func NewCreator

func NewCreator(t TestingT, logger *config_types.Logger) *Creator

func (*Creator) CreateAsset

func (f *Creator) CreateAsset(user *format.User, project *format.Project, release *format.Release, name, content string) *format.ReleaseAsset

func (*Creator) CreateComment

func (f *Creator) CreateComment(user *format.User, project *format.Project, commentable format.Commentable, exemplar *format.Comment) *format.Comment

func (*Creator) CreateIssue

func (f *Creator) CreateIssue(user *format.User, project *format.Project, labels []*format.Label, milestones []*format.Milestone) *format.Issue

func (*Creator) CreateLabel

func (f *Creator) CreateLabel() *format.Label

func (*Creator) CreateMilestone

func (f *Creator) CreateMilestone() *format.Milestone

func (*Creator) CreateProject

func (f *Creator) CreateProject(user *format.User) *format.Project

func (*Creator) CreatePullRequest

func (f *Creator) CreatePullRequest(user *format.User, project *format.Project, repository *format.Repository, dir string) *format.PullRequest

func (*Creator) CreateReaction

func (f *Creator) CreateReaction(user *format.User) *format.Reaction

func (*Creator) CreateRelease

func (f *Creator) CreateRelease(user *format.User, project *format.Project, repositoryHelper *RepositoryTestHelper) *format.Release

func (*Creator) CreateRepository

func (f *Creator) CreateRepository(name string) *format.Repository

func (*Creator) CreateReview

func (f *Creator) CreateReview(user *format.User, project *format.Project, reviewable format.Reviewable, repositoryHelper *RepositoryTestHelper) *format.Review

func (*Creator) CreateTopic

func (f *Creator) CreateTopic() *format.Topic

func (*Creator) CreateUser

func (f *Creator) CreateUser(id int64) *format.User

func (*Creator) GetDirectory

func (f *Creator) GetDirectory() string

func (*Creator) GetRepositoryDirectory

func (f *Creator) GetRepositoryDirectory(repository *format.Repository) string

type ForgeInstance

type ForgeInstance struct {
	Ctx     context.Context
	T       TestingT
	G       common.DriverInterface
	Creator *Creator
	Logger  *config_types.Logger
}

func (*ForgeInstance) CreateIssue

func (o *ForgeInstance) CreateIssue(user, project common.ContainerObjectInterface) (*format.Issue, common.ContainerObjectInterface, func())

func (*ForgeInstance) CreateMilestone

func (o *ForgeInstance) CreateMilestone(user, project common.ContainerObjectInterface) (*format.Milestone, common.ContainerObjectInterface, func())

func (*ForgeInstance) CreateProject

func (*ForgeInstance) CreatePullRequest

func (o *ForgeInstance) CreatePullRequest(user, project, repository common.ContainerObjectInterface) (*format.PullRequest, common.ContainerObjectInterface, *format.Repository, string, func())

func (*ForgeInstance) CreateRelease

func (o *ForgeInstance) CreateRelease(user, project, repository common.ContainerObjectInterface) (*format.Release, common.ContainerObjectInterface, func())

func (*ForgeInstance) CreateRepository

func (*ForgeInstance) CreateUser

func (o *ForgeInstance) CreateUser() (*format.User, common.ContainerObjectInterface, func())

func (*ForgeInstance) GetCreator

func (o *ForgeInstance) GetCreator() *Creator

func (*ForgeInstance) GetCtx

func (o *ForgeInstance) GetCtx() context.Context

func (*ForgeInstance) GetLogger

func (o *ForgeInstance) GetLogger() *config_types.Logger

func (*ForgeInstance) GetProvider

func (*ForgeInstance) GetT

func (o *ForgeInstance) GetT() TestingT

func (*ForgeInstance) Init

func (*ForgeInstance) LocalRepository

func (o *ForgeInstance) LocalRepository(remote *format.Repository) (*format.Repository, string)

type ForgeTestInterface

type ForgeTestInterface interface {
	GetCtx() context.Context
	GetT() TestingT
	GetCreator() *Creator
	GetLogger() *config_types.Logger
	GetProvider(string, common.ProviderInterface) common.ProviderInterface

	CreateUser() (*format.User, common.ContainerObjectInterface, func())
	CreateProject(user common.ContainerObjectInterface) (*format.Project, common.ContainerObjectInterface, func())
	CreateMilestone(user, project common.ContainerObjectInterface) (*format.Milestone, common.ContainerObjectInterface, func())
	CreateIssue(user, project common.ContainerObjectInterface) (*format.Issue, common.ContainerObjectInterface, func())
	CreateRepository(user, project common.ContainerObjectInterface) (*format.Repository, common.ContainerObjectInterface)
	LocalRepository(remote *format.Repository) (*format.Repository, string)
	CreatePullRequest(user, project, repository common.ContainerObjectInterface) (*format.PullRequest, common.ContainerObjectInterface, *format.Repository, string, func())
	CreateRelease(user, project, repository common.ContainerObjectInterface) (*format.Release, common.ContainerObjectInterface, func())
}

type ProviderOptions

type ProviderOptions struct {
	Retry        bool
	CmpOptions   cmp.Options
	NoComparePut bool
	NoDelete     bool
	ModifiedPut  bool
}

type RepositoryTestHelper

type RepositoryTestHelper struct {
	// contains filtered or unexported fields
}

func NewRepositoryTestHelper

func NewRepositoryTestHelper(t TestingT, d string) *RepositoryTestHelper

func (*RepositoryTestHelper) AssertRepositoryFileExists

func (o *RepositoryTestHelper) AssertRepositoryFileExists(file string)

func (*RepositoryTestHelper) AssertRepositoryNotFileExists

func (o *RepositoryTestHelper) AssertRepositoryNotFileExists(file string)

func (*RepositoryTestHelper) BranchRepositoryFeature

func (o *RepositoryTestHelper) BranchRepositoryFeature(branch, content string)

func (*RepositoryTestHelper) CloneWrapper

func (o *RepositoryTestHelper) CloneWrapper(fun func(clone *RepositoryTestHelper))

func (*RepositoryTestHelper) CreateRepositoryContent

func (o *RepositoryTestHelper) CreateRepositoryContent()

func (*RepositoryTestHelper) CreateRepositoryTag

func (o *RepositoryTestHelper) CreateRepositoryTag(tag, commit string)

func (*RepositoryTestHelper) GetRepositorySha

func (o *RepositoryTestHelper) GetRepositorySha(branch string) string

func (*RepositoryTestHelper) InternalBranchRepositoryFeature

func (o *RepositoryTestHelper) InternalBranchRepositoryFeature(branch, content string)

func (*RepositoryTestHelper) RevList

func (o *RepositoryTestHelper) RevList() string

type TestingT

type TestingT interface {
	assert.TestingT
	TempDir() string
	Skip(args ...any)
}

Jump to

Keyboard shortcuts

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