fixtures

package
v0.0.0-...-feac726 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatabaseMock

type DatabaseMock struct {
	// CommitFunc mocks the Commit method.
	CommitFunc func(kills []models.Kill) error

	// CommitFlagCaptureFunc mocks the CommitFlagCapture method.
	CommitFlagCaptureFunc func(capture models.FlagCapture) error

	// CommitMapStatsFunc mocks the CommitMapStats method.
	CommitMapStatsFunc func(stats models.MapStats) error

	// CommitMapVotesFunc mocks the CommitMapVotes method.
	CommitMapVotesFunc func(votes models.MapVotes) error

	// CommitPlayerFunc mocks the CommitPlayer method.
	CommitPlayerFunc func(player *models.Player) error

	// InitDBFunc mocks the InitDB method.
	InitDBFunc func() error

	// UpdatePlayerInfoFunc mocks the UpdatePlayerInfo method.
	UpdatePlayerInfoFunc func(player *models.Player) error

	// UpdateServerInfoFunc mocks the UpdateServerInfo method.
	UpdateServerInfoFunc func(server *models.Server) error

	// UpdateServerStatusFunc mocks the UpdateServerStatus method.
	UpdateServerStatusFunc func(server models.Server, status bool) error
	// contains filtered or unexported fields
}

DatabaseMock is a mock implementation of database.Database.

func TestSomethingThatUsesDatabase(t *testing.T) {

	// make and configure a mocked database.Database
	mockedDatabase := &DatabaseMock{
		CommitFunc: func(kills []models.Kill) error {
			panic("mock out the Commit method")
		},
		CommitFlagCaptureFunc: func(capture models.FlagCapture) error {
			panic("mock out the CommitFlagCapture method")
		},
		CommitMapStatsFunc: func(stats models.MapStats) error {
			panic("mock out the CommitMapStats method")
		},
		CommitMapVotesFunc: func(votes models.MapVotes) error {
			panic("mock out the CommitMapVotes method")
		},
		CommitPlayerFunc: func(player *models.Player) error {
			panic("mock out the CommitPlayer method")
		},
		InitDBFunc: func() error {
			panic("mock out the InitDB method")
		},
		UpdatePlayerInfoFunc: func(player *models.Player) error {
			panic("mock out the UpdatePlayerInfo method")
		},
		UpdateServerInfoFunc: func(server *models.Server) error {
			panic("mock out the UpdateServerInfo method")
		},
		UpdateServerStatusFunc: func(server models.Server, status bool) error {
			panic("mock out the UpdateServerStatus method")
		},
	}

	// use mockedDatabase in code that requires database.Database
	// and then make assertions.

}

func (*DatabaseMock) Commit

func (mock *DatabaseMock) Commit(kills []models.Kill) error

Commit calls CommitFunc.

func (*DatabaseMock) CommitCalls

func (mock *DatabaseMock) CommitCalls() []struct {
	Kills []models.Kill
}

CommitCalls gets all the calls that were made to Commit. Check the length with:

len(mockedDatabase.CommitCalls())

func (*DatabaseMock) CommitFlagCapture

func (mock *DatabaseMock) CommitFlagCapture(capture models.FlagCapture) error

CommitFlagCapture calls CommitFlagCaptureFunc.

func (*DatabaseMock) CommitFlagCaptureCalls

func (mock *DatabaseMock) CommitFlagCaptureCalls() []struct {
	Capture models.FlagCapture
}

CommitFlagCaptureCalls gets all the calls that were made to CommitFlagCapture. Check the length with:

len(mockedDatabase.CommitFlagCaptureCalls())

func (*DatabaseMock) CommitMapStats

func (mock *DatabaseMock) CommitMapStats(stats models.MapStats) error

CommitMapStats calls CommitMapStatsFunc.

func (*DatabaseMock) CommitMapStatsCalls

func (mock *DatabaseMock) CommitMapStatsCalls() []struct {
	Stats models.MapStats
}

CommitMapStatsCalls gets all the calls that were made to CommitMapStats. Check the length with:

len(mockedDatabase.CommitMapStatsCalls())

func (*DatabaseMock) CommitMapVotes

func (mock *DatabaseMock) CommitMapVotes(votes models.MapVotes) error

CommitMapVotes calls CommitMapVotesFunc.

func (*DatabaseMock) CommitMapVotesCalls

func (mock *DatabaseMock) CommitMapVotesCalls() []struct {
	Votes models.MapVotes
}

CommitMapVotesCalls gets all the calls that were made to CommitMapVotes. Check the length with:

len(mockedDatabase.CommitMapVotesCalls())

func (*DatabaseMock) CommitPlayer

func (mock *DatabaseMock) CommitPlayer(player *models.Player) error

CommitPlayer calls CommitPlayerFunc.

func (*DatabaseMock) CommitPlayerCalls

func (mock *DatabaseMock) CommitPlayerCalls() []struct {
	Player *models.Player
}

CommitPlayerCalls gets all the calls that were made to CommitPlayer. Check the length with:

len(mockedDatabase.CommitPlayerCalls())

func (*DatabaseMock) InitDB

func (mock *DatabaseMock) InitDB() error

InitDB calls InitDBFunc.

func (*DatabaseMock) InitDBCalls

func (mock *DatabaseMock) InitDBCalls() []struct {
}

InitDBCalls gets all the calls that were made to InitDB. Check the length with:

len(mockedDatabase.InitDBCalls())

func (*DatabaseMock) UpdatePlayerInfo

func (mock *DatabaseMock) UpdatePlayerInfo(player *models.Player) error

UpdatePlayerInfo calls UpdatePlayerInfoFunc.

func (*DatabaseMock) UpdatePlayerInfoCalls

func (mock *DatabaseMock) UpdatePlayerInfoCalls() []struct {
	Player *models.Player
}

UpdatePlayerInfoCalls gets all the calls that were made to UpdatePlayerInfo. Check the length with:

len(mockedDatabase.UpdatePlayerInfoCalls())

func (*DatabaseMock) UpdateServerInfo

func (mock *DatabaseMock) UpdateServerInfo(server *models.Server) error

UpdateServerInfo calls UpdateServerInfoFunc.

func (*DatabaseMock) UpdateServerInfoCalls

func (mock *DatabaseMock) UpdateServerInfoCalls() []struct {
	Server *models.Server
}

UpdateServerInfoCalls gets all the calls that were made to UpdateServerInfo. Check the length with:

len(mockedDatabase.UpdateServerInfoCalls())

func (*DatabaseMock) UpdateServerStatus

func (mock *DatabaseMock) UpdateServerStatus(server models.Server, status bool) error

UpdateServerStatus calls UpdateServerStatusFunc.

func (*DatabaseMock) UpdateServerStatusCalls

func (mock *DatabaseMock) UpdateServerStatusCalls() []struct {
	Server models.Server
	Status bool
}

UpdateServerStatusCalls gets all the calls that were made to UpdateServerStatus. Check the length with:

len(mockedDatabase.UpdateServerStatusCalls())

Jump to

Keyboard shortcuts

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