storetest

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoDBMock

type MongoDBMock struct {
	// CheckAllBundleContentsAreApprovedFunc mocks the CheckAllBundleContentsAreApproved method.
	CheckAllBundleContentsAreApprovedFunc func(ctx context.Context, bundleID string) (bool, error)

	// CheckBundleExistsFunc mocks the CheckBundleExists method.
	CheckBundleExistsFunc func(ctx context.Context, bundleID string) (bool, error)

	// CheckBundleExistsByTitleFunc mocks the CheckBundleExistsByTitle method.
	CheckBundleExistsByTitleFunc func(ctx context.Context, title string) (bool, error)

	// CheckBundleExistsByTitleUpdateFunc mocks the CheckBundleExistsByTitleUpdate method.
	CheckBundleExistsByTitleUpdateFunc func(ctx context.Context, title string, excludeID string) (bool, error)

	// CheckContentItemExistsByDatasetEditionVersionFunc mocks the CheckContentItemExistsByDatasetEditionVersion method.
	CheckContentItemExistsByDatasetEditionVersionFunc func(ctx context.Context, datasetID string, editionID string, versionID int) (bool, error)

	// CheckerFunc mocks the Checker method.
	CheckerFunc func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error

	// CloseFunc mocks the Close method.
	CloseFunc func(contextMoqParam context.Context) error

	// CreateBundleFunc mocks the CreateBundle method.
	CreateBundleFunc func(ctx context.Context, bundle *models.Bundle) error

	// CreateContentItemFunc mocks the CreateContentItem method.
	CreateContentItemFunc func(ctx context.Context, contentItem *models.ContentItem) error

	// CreateEventFunc mocks the CreateEvent method.
	CreateEventFunc func(ctx context.Context, event *models.Event) error

	// DeleteBundleFunc mocks the DeleteBundle method.
	DeleteBundleFunc func(ctx context.Context, id string) error

	// DeleteContentItemFunc mocks the DeleteContentItem method.
	DeleteContentItemFunc func(ctx context.Context, contentItemID string) error

	// GetBundleFunc mocks the GetBundle method.
	GetBundleFunc func(ctx context.Context, bundleID string) (*models.Bundle, error)

	// GetBundleContentsForBundleFunc mocks the GetBundleContentsForBundle method.
	GetBundleContentsForBundleFunc func(ctx context.Context, bundleID string) (*[]models.ContentItem, error)

	// GetContentItemByBundleIDAndContentItemIDFunc mocks the GetContentItemByBundleIDAndContentItemID method.
	GetContentItemByBundleIDAndContentItemIDFunc func(ctx context.Context, bundleID string, contentItemID string) (*models.ContentItem, error)

	// GetContentItemsByBundleIDFunc mocks the GetContentItemsByBundleID method.
	GetContentItemsByBundleIDFunc func(ctx context.Context, bundleID string) ([]*models.ContentItem, error)

	// ListBundleContentIDsWithoutLimitFunc mocks the ListBundleContentIDsWithoutLimit method.
	ListBundleContentIDsWithoutLimitFunc func(ctx context.Context, bundleID string) ([]*models.ContentItem, error)

	// ListBundleContentsFunc mocks the ListBundleContents method.
	ListBundleContentsFunc func(ctx context.Context, bundleID string, offset int, limit int) ([]*models.ContentItem, int, error)

	// ListBundleEventsFunc mocks the ListBundleEvents method.
	ListBundleEventsFunc func(ctx context.Context, offset int, limit int, bundleID string, after *time.Time, before *time.Time) ([]*models.Event, int, error)

	// ListBundlesFunc mocks the ListBundles method.
	ListBundlesFunc func(ctx context.Context, offset int, limit int, filtersMoqParam *filters.BundleFilters) ([]*models.Bundle, int, error)

	// UpdateBundleFunc mocks the UpdateBundle method.
	UpdateBundleFunc func(ctx context.Context, id string, update *models.Bundle) (*models.Bundle, error)

	// UpdateBundleETagFunc mocks the UpdateBundleETag method.
	UpdateBundleETagFunc func(ctx context.Context, bundleID string, email string) (*models.Bundle, error)

	// UpdateContentItemDatasetInfoFunc mocks the UpdateContentItemDatasetInfo method.
	UpdateContentItemDatasetInfoFunc func(ctx context.Context, contentItemID string, title string, state string) error

	// UpdateContentItemStateFunc mocks the UpdateContentItemState method.
	UpdateContentItemStateFunc func(ctx context.Context, contentItemID string, state string) error
	// contains filtered or unexported fields
}

MongoDBMock is a mock implementation of store.MongoDB.

func TestSomethingThatUsesMongoDB(t *testing.T) {

	// make and configure a mocked store.MongoDB
	mockedMongoDB := &MongoDBMock{
		CheckAllBundleContentsAreApprovedFunc: func(ctx context.Context, bundleID string) (bool, error) {
			panic("mock out the CheckAllBundleContentsAreApproved method")
		},
		CheckBundleExistsFunc: func(ctx context.Context, bundleID string) (bool, error) {
			panic("mock out the CheckBundleExists method")
		},
		CheckBundleExistsByTitleFunc: func(ctx context.Context, title string) (bool, error) {
			panic("mock out the CheckBundleExistsByTitle method")
		},
		CheckBundleExistsByTitleUpdateFunc: func(ctx context.Context, title string, excludeID string) (bool, error) {
			panic("mock out the CheckBundleExistsByTitleUpdate method")
		},
		CheckContentItemExistsByDatasetEditionVersionFunc: func(ctx context.Context, datasetID string, editionID string, versionID int) (bool, error) {
			panic("mock out the CheckContentItemExistsByDatasetEditionVersion method")
		},
		CheckerFunc: func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
		CloseFunc: func(contextMoqParam context.Context) error {
			panic("mock out the Close method")
		},
		CreateBundleFunc: func(ctx context.Context, bundle *models.Bundle) error {
			panic("mock out the CreateBundle method")
		},
		CreateContentItemFunc: func(ctx context.Context, contentItem *models.ContentItem) error {
			panic("mock out the CreateContentItem method")
		},
		CreateEventFunc: func(ctx context.Context, event *models.Event) error {
			panic("mock out the CreateEvent method")
		},
		DeleteBundleFunc: func(ctx context.Context, id string) error {
			panic("mock out the DeleteBundle method")
		},
		DeleteContentItemFunc: func(ctx context.Context, contentItemID string) error {
			panic("mock out the DeleteContentItem method")
		},
		GetBundleFunc: func(ctx context.Context, bundleID string) (*models.Bundle, error) {
			panic("mock out the GetBundle method")
		},
		GetBundleContentsForBundleFunc: func(ctx context.Context, bundleID string) (*[]models.ContentItem, error) {
			panic("mock out the GetBundleContentsForBundle method")
		},
		GetContentItemByBundleIDAndContentItemIDFunc: func(ctx context.Context, bundleID string, contentItemID string) (*models.ContentItem, error) {
			panic("mock out the GetContentItemByBundleIDAndContentItemID method")
		},
		GetContentItemsByBundleIDFunc: func(ctx context.Context, bundleID string) ([]*models.ContentItem, error) {
			panic("mock out the GetContentItemsByBundleID method")
		},
		ListBundleContentIDsWithoutLimitFunc: func(ctx context.Context, bundleID string) ([]*models.ContentItem, error) {
			panic("mock out the ListBundleContentIDsWithoutLimit method")
		},
		ListBundleContentsFunc: func(ctx context.Context, bundleID string, offset int, limit int) ([]*models.ContentItem, int, error) {
			panic("mock out the ListBundleContents method")
		},
		ListBundleEventsFunc: func(ctx context.Context, offset int, limit int, bundleID string, after *time.Time, before *time.Time) ([]*models.Event, int, error) {
			panic("mock out the ListBundleEvents method")
		},
		ListBundlesFunc: func(ctx context.Context, offset int, limit int, filtersMoqParam *filters.BundleFilters) ([]*models.Bundle, int, error) {
			panic("mock out the ListBundles method")
		},
		UpdateBundleFunc: func(ctx context.Context, id string, update *models.Bundle) (*models.Bundle, error) {
			panic("mock out the UpdateBundle method")
		},
		UpdateBundleETagFunc: func(ctx context.Context, bundleID string, email string) (*models.Bundle, error) {
			panic("mock out the UpdateBundleETag method")
		},
		UpdateContentItemDatasetInfoFunc: func(ctx context.Context, contentItemID string, title string, state string) error {
			panic("mock out the UpdateContentItemDatasetInfo method")
		},
		UpdateContentItemStateFunc: func(ctx context.Context, contentItemID string, state string) error {
			panic("mock out the UpdateContentItemState method")
		},
	}

	// use mockedMongoDB in code that requires store.MongoDB
	// and then make assertions.

}

func (*MongoDBMock) CheckAllBundleContentsAreApproved added in v1.2.0

func (mock *MongoDBMock) CheckAllBundleContentsAreApproved(ctx context.Context, bundleID string) (bool, error)

CheckAllBundleContentsAreApproved calls CheckAllBundleContentsAreApprovedFunc.

func (*MongoDBMock) CheckAllBundleContentsAreApprovedCalls added in v1.2.0

func (mock *MongoDBMock) CheckAllBundleContentsAreApprovedCalls() []struct {
	Ctx      context.Context
	BundleID string
}

CheckAllBundleContentsAreApprovedCalls gets all the calls that were made to CheckAllBundleContentsAreApproved. Check the length with:

len(mockedMongoDB.CheckAllBundleContentsAreApprovedCalls())

func (*MongoDBMock) CheckBundleExists added in v1.3.0

func (mock *MongoDBMock) CheckBundleExists(ctx context.Context, bundleID string) (bool, error)

CheckBundleExists calls CheckBundleExistsFunc.

func (*MongoDBMock) CheckBundleExistsByTitle added in v1.4.0

func (mock *MongoDBMock) CheckBundleExistsByTitle(ctx context.Context, title string) (bool, error)

CheckBundleExistsByTitle calls CheckBundleExistsByTitleFunc.

func (*MongoDBMock) CheckBundleExistsByTitleCalls added in v1.4.0

func (mock *MongoDBMock) CheckBundleExistsByTitleCalls() []struct {
	Ctx   context.Context
	Title string
}

CheckBundleExistsByTitleCalls gets all the calls that were made to CheckBundleExistsByTitle. Check the length with:

len(mockedMongoDB.CheckBundleExistsByTitleCalls())

func (*MongoDBMock) CheckBundleExistsByTitleUpdate added in v1.4.0

func (mock *MongoDBMock) CheckBundleExistsByTitleUpdate(ctx context.Context, title string, excludeID string) (bool, error)

CheckBundleExistsByTitleUpdate calls CheckBundleExistsByTitleUpdateFunc.

func (*MongoDBMock) CheckBundleExistsByTitleUpdateCalls added in v1.4.0

func (mock *MongoDBMock) CheckBundleExistsByTitleUpdateCalls() []struct {
	Ctx       context.Context
	Title     string
	ExcludeID string
}

CheckBundleExistsByTitleUpdateCalls gets all the calls that were made to CheckBundleExistsByTitleUpdate. Check the length with:

len(mockedMongoDB.CheckBundleExistsByTitleUpdateCalls())

func (*MongoDBMock) CheckBundleExistsCalls added in v1.3.0

func (mock *MongoDBMock) CheckBundleExistsCalls() []struct {
	Ctx      context.Context
	BundleID string
}

CheckBundleExistsCalls gets all the calls that were made to CheckBundleExists. Check the length with:

len(mockedMongoDB.CheckBundleExistsCalls())

func (*MongoDBMock) CheckContentItemExistsByDatasetEditionVersion added in v1.3.0

func (mock *MongoDBMock) CheckContentItemExistsByDatasetEditionVersion(ctx context.Context, datasetID string, editionID string, versionID int) (bool, error)

CheckContentItemExistsByDatasetEditionVersion calls CheckContentItemExistsByDatasetEditionVersionFunc.

func (*MongoDBMock) CheckContentItemExistsByDatasetEditionVersionCalls added in v1.3.0

func (mock *MongoDBMock) CheckContentItemExistsByDatasetEditionVersionCalls() []struct {
	Ctx       context.Context
	DatasetID string
	EditionID string
	VersionID int
}

CheckContentItemExistsByDatasetEditionVersionCalls gets all the calls that were made to CheckContentItemExistsByDatasetEditionVersion. Check the length with:

len(mockedMongoDB.CheckContentItemExistsByDatasetEditionVersionCalls())

func (*MongoDBMock) Checker

func (mock *MongoDBMock) Checker(contextMoqParam context.Context, checkState *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*MongoDBMock) CheckerCalls

func (mock *MongoDBMock) CheckerCalls() []struct {
	ContextMoqParam context.Context
	CheckState      *healthcheck.CheckState
}

CheckerCalls gets all the calls that were made to Checker. Check the length with:

len(mockedMongoDB.CheckerCalls())

func (*MongoDBMock) Close

func (mock *MongoDBMock) Close(contextMoqParam context.Context) error

Close calls CloseFunc.

func (*MongoDBMock) CloseCalls

func (mock *MongoDBMock) CloseCalls() []struct {
	ContextMoqParam context.Context
}

CloseCalls gets all the calls that were made to Close. Check the length with:

len(mockedMongoDB.CloseCalls())

func (*MongoDBMock) CreateBundle added in v1.4.0

func (mock *MongoDBMock) CreateBundle(ctx context.Context, bundle *models.Bundle) error

CreateBundle calls CreateBundleFunc.

func (*MongoDBMock) CreateBundleCalls added in v1.4.0

func (mock *MongoDBMock) CreateBundleCalls() []struct {
	Ctx    context.Context
	Bundle *models.Bundle
}

CreateBundleCalls gets all the calls that were made to CreateBundle. Check the length with:

len(mockedMongoDB.CreateBundleCalls())

func (*MongoDBMock) CreateContentItem added in v1.3.0

func (mock *MongoDBMock) CreateContentItem(ctx context.Context, contentItem *models.ContentItem) error

CreateContentItem calls CreateContentItemFunc.

func (*MongoDBMock) CreateContentItemCalls added in v1.3.0

func (mock *MongoDBMock) CreateContentItemCalls() []struct {
	Ctx         context.Context
	ContentItem *models.ContentItem
}

CreateContentItemCalls gets all the calls that were made to CreateContentItem. Check the length with:

len(mockedMongoDB.CreateContentItemCalls())

func (*MongoDBMock) CreateEvent added in v1.10.0

func (mock *MongoDBMock) CreateEvent(ctx context.Context, event *models.Event) error

CreateEvent calls CreateEventFunc.

func (*MongoDBMock) CreateEventCalls added in v1.10.0

func (mock *MongoDBMock) CreateEventCalls() []struct {
	Ctx   context.Context
	Event *models.Event
}

CreateEventCalls gets all the calls that were made to CreateEvent. Check the length with:

len(mockedMongoDB.CreateEventCalls())

func (*MongoDBMock) DeleteBundle added in v1.4.0

func (mock *MongoDBMock) DeleteBundle(ctx context.Context, id string) error

DeleteBundle calls DeleteBundleFunc.

func (*MongoDBMock) DeleteBundleCalls added in v1.4.0

func (mock *MongoDBMock) DeleteBundleCalls() []struct {
	Ctx context.Context
	ID  string
}

DeleteBundleCalls gets all the calls that were made to DeleteBundle. Check the length with:

len(mockedMongoDB.DeleteBundleCalls())

func (*MongoDBMock) DeleteContentItem added in v1.4.0

func (mock *MongoDBMock) DeleteContentItem(ctx context.Context, contentItemID string) error

DeleteContentItem calls DeleteContentItemFunc.

func (*MongoDBMock) DeleteContentItemCalls added in v1.4.0

func (mock *MongoDBMock) DeleteContentItemCalls() []struct {
	Ctx           context.Context
	ContentItemID string
}

DeleteContentItemCalls gets all the calls that were made to DeleteContentItem. Check the length with:

len(mockedMongoDB.DeleteContentItemCalls())

func (*MongoDBMock) GetBundle added in v1.3.0

func (mock *MongoDBMock) GetBundle(ctx context.Context, bundleID string) (*models.Bundle, error)

GetBundle calls GetBundleFunc.

func (*MongoDBMock) GetBundleCalls added in v1.3.0

func (mock *MongoDBMock) GetBundleCalls() []struct {
	Ctx      context.Context
	BundleID string
}

GetBundleCalls gets all the calls that were made to GetBundle. Check the length with:

len(mockedMongoDB.GetBundleCalls())

func (*MongoDBMock) GetBundleContentsForBundle added in v1.4.0

func (mock *MongoDBMock) GetBundleContentsForBundle(ctx context.Context, bundleID string) (*[]models.ContentItem, error)

GetBundleContentsForBundle calls GetBundleContentsForBundleFunc.

func (*MongoDBMock) GetBundleContentsForBundleCalls added in v1.4.0

func (mock *MongoDBMock) GetBundleContentsForBundleCalls() []struct {
	Ctx      context.Context
	BundleID string
}

GetBundleContentsForBundleCalls gets all the calls that were made to GetBundleContentsForBundle. Check the length with:

len(mockedMongoDB.GetBundleContentsForBundleCalls())

func (*MongoDBMock) GetContentItemByBundleIDAndContentItemID added in v1.4.0

func (mock *MongoDBMock) GetContentItemByBundleIDAndContentItemID(ctx context.Context, bundleID string, contentItemID string) (*models.ContentItem, error)

GetContentItemByBundleIDAndContentItemID calls GetContentItemByBundleIDAndContentItemIDFunc.

func (*MongoDBMock) GetContentItemByBundleIDAndContentItemIDCalls added in v1.4.0

func (mock *MongoDBMock) GetContentItemByBundleIDAndContentItemIDCalls() []struct {
	Ctx           context.Context
	BundleID      string
	ContentItemID string
}

GetContentItemByBundleIDAndContentItemIDCalls gets all the calls that were made to GetContentItemByBundleIDAndContentItemID. Check the length with:

len(mockedMongoDB.GetContentItemByBundleIDAndContentItemIDCalls())

func (*MongoDBMock) GetContentItemsByBundleID added in v1.4.0

func (mock *MongoDBMock) GetContentItemsByBundleID(ctx context.Context, bundleID string) ([]*models.ContentItem, error)

GetContentItemsByBundleID calls GetContentItemsByBundleIDFunc.

func (*MongoDBMock) GetContentItemsByBundleIDCalls added in v1.4.0

func (mock *MongoDBMock) GetContentItemsByBundleIDCalls() []struct {
	Ctx      context.Context
	BundleID string
}

GetContentItemsByBundleIDCalls gets all the calls that were made to GetContentItemsByBundleID. Check the length with:

len(mockedMongoDB.GetContentItemsByBundleIDCalls())

func (*MongoDBMock) ListBundleContentIDsWithoutLimit added in v1.4.0

func (mock *MongoDBMock) ListBundleContentIDsWithoutLimit(ctx context.Context, bundleID string) ([]*models.ContentItem, error)

ListBundleContentIDsWithoutLimit calls ListBundleContentIDsWithoutLimitFunc.

func (*MongoDBMock) ListBundleContentIDsWithoutLimitCalls added in v1.4.0

func (mock *MongoDBMock) ListBundleContentIDsWithoutLimitCalls() []struct {
	Ctx      context.Context
	BundleID string
}

ListBundleContentIDsWithoutLimitCalls gets all the calls that were made to ListBundleContentIDsWithoutLimit. Check the length with:

len(mockedMongoDB.ListBundleContentIDsWithoutLimitCalls())

func (*MongoDBMock) ListBundleContents added in v1.4.0

func (mock *MongoDBMock) ListBundleContents(ctx context.Context, bundleID string, offset int, limit int) ([]*models.ContentItem, int, error)

ListBundleContents calls ListBundleContentsFunc.

func (*MongoDBMock) ListBundleContentsCalls added in v1.4.0

func (mock *MongoDBMock) ListBundleContentsCalls() []struct {
	Ctx      context.Context
	BundleID string
	Offset   int
	Limit    int
}

ListBundleContentsCalls gets all the calls that were made to ListBundleContents. Check the length with:

len(mockedMongoDB.ListBundleContentsCalls())

func (*MongoDBMock) ListBundleEvents added in v1.3.0

func (mock *MongoDBMock) ListBundleEvents(ctx context.Context, offset int, limit int, bundleID string, after *time.Time, before *time.Time) ([]*models.Event, int, error)

ListBundleEvents calls ListBundleEventsFunc.

func (*MongoDBMock) ListBundleEventsCalls added in v1.3.0

func (mock *MongoDBMock) ListBundleEventsCalls() []struct {
	Ctx      context.Context
	Offset   int
	Limit    int
	BundleID string
	After    *time.Time
	Before   *time.Time
}

ListBundleEventsCalls gets all the calls that were made to ListBundleEvents. Check the length with:

len(mockedMongoDB.ListBundleEventsCalls())

func (*MongoDBMock) ListBundles

func (mock *MongoDBMock) ListBundles(ctx context.Context, offset int, limit int, filtersMoqParam *filters.BundleFilters) ([]*models.Bundle, int, error)

ListBundles calls ListBundlesFunc.

func (*MongoDBMock) ListBundlesCalls

func (mock *MongoDBMock) ListBundlesCalls() []struct {
	Ctx             context.Context
	Offset          int
	Limit           int
	FiltersMoqParam *filters.BundleFilters
}

ListBundlesCalls gets all the calls that were made to ListBundles. Check the length with:

len(mockedMongoDB.ListBundlesCalls())

func (*MongoDBMock) UpdateBundle added in v1.4.0

func (mock *MongoDBMock) UpdateBundle(ctx context.Context, id string, update *models.Bundle) (*models.Bundle, error)

UpdateBundle calls UpdateBundleFunc.

func (*MongoDBMock) UpdateBundleCalls added in v1.4.0

func (mock *MongoDBMock) UpdateBundleCalls() []struct {
	Ctx    context.Context
	ID     string
	Update *models.Bundle
}

UpdateBundleCalls gets all the calls that were made to UpdateBundle. Check the length with:

len(mockedMongoDB.UpdateBundleCalls())

func (*MongoDBMock) UpdateBundleETag added in v1.3.0

func (mock *MongoDBMock) UpdateBundleETag(ctx context.Context, bundleID string, email string) (*models.Bundle, error)

UpdateBundleETag calls UpdateBundleETagFunc.

func (*MongoDBMock) UpdateBundleETagCalls added in v1.3.0

func (mock *MongoDBMock) UpdateBundleETagCalls() []struct {
	Ctx      context.Context
	BundleID string
	Email    string
}

UpdateBundleETagCalls gets all the calls that were made to UpdateBundleETag. Check the length with:

len(mockedMongoDB.UpdateBundleETagCalls())

func (*MongoDBMock) UpdateContentItemDatasetInfo added in v1.4.0

func (mock *MongoDBMock) UpdateContentItemDatasetInfo(ctx context.Context, contentItemID string, title string, state string) error

UpdateContentItemDatasetInfo calls UpdateContentItemDatasetInfoFunc.

func (*MongoDBMock) UpdateContentItemDatasetInfoCalls added in v1.4.0

func (mock *MongoDBMock) UpdateContentItemDatasetInfoCalls() []struct {
	Ctx           context.Context
	ContentItemID string
	Title         string
	State         string
}

UpdateContentItemDatasetInfoCalls gets all the calls that were made to UpdateContentItemDatasetInfo. Check the length with:

len(mockedMongoDB.UpdateContentItemDatasetInfoCalls())

func (*MongoDBMock) UpdateContentItemState added in v1.4.0

func (mock *MongoDBMock) UpdateContentItemState(ctx context.Context, contentItemID string, state string) error

UpdateContentItemState calls UpdateContentItemStateFunc.

func (*MongoDBMock) UpdateContentItemStateCalls added in v1.4.0

func (mock *MongoDBMock) UpdateContentItemStateCalls() []struct {
	Ctx           context.Context
	ContentItemID string
	State         string
}

UpdateContentItemStateCalls gets all the calls that were made to UpdateContentItemState. Check the length with:

len(mockedMongoDB.UpdateContentItemStateCalls())

type StorerMock

type StorerMock struct {
	// CheckAllBundleContentsAreApprovedFunc mocks the CheckAllBundleContentsAreApproved method.
	CheckAllBundleContentsAreApprovedFunc func(ctx context.Context, bundleID string) (bool, error)

	// CheckBundleExistsFunc mocks the CheckBundleExists method.
	CheckBundleExistsFunc func(ctx context.Context, bundleID string) (bool, error)

	// CheckBundleExistsByTitleFunc mocks the CheckBundleExistsByTitle method.
	CheckBundleExistsByTitleFunc func(ctx context.Context, title string) (bool, error)

	// CheckBundleExistsByTitleUpdateFunc mocks the CheckBundleExistsByTitleUpdate method.
	CheckBundleExistsByTitleUpdateFunc func(ctx context.Context, title string, excludeID string) (bool, error)

	// CheckContentItemExistsByDatasetEditionVersionFunc mocks the CheckContentItemExistsByDatasetEditionVersion method.
	CheckContentItemExistsByDatasetEditionVersionFunc func(ctx context.Context, datasetID string, editionID string, versionID int) (bool, error)

	// CheckerFunc mocks the Checker method.
	CheckerFunc func(ctx context.Context, state *healthcheck.CheckState) error

	// CloseFunc mocks the Close method.
	CloseFunc func(ctx context.Context) error

	// CreateBundleFunc mocks the CreateBundle method.
	CreateBundleFunc func(ctx context.Context, bundle *models.Bundle) error

	// CreateContentItemFunc mocks the CreateContentItem method.
	CreateContentItemFunc func(ctx context.Context, contentItem *models.ContentItem) error

	// CreateEventFunc mocks the CreateEvent method.
	CreateEventFunc func(ctx context.Context, event *models.Event) error

	// DeleteBundleFunc mocks the DeleteBundle method.
	DeleteBundleFunc func(ctx context.Context, id string) error

	// DeleteContentItemFunc mocks the DeleteContentItem method.
	DeleteContentItemFunc func(ctx context.Context, contentItemID string) error

	// GetBundleFunc mocks the GetBundle method.
	GetBundleFunc func(ctx context.Context, bundleID string) (*models.Bundle, error)

	// GetBundleContentsForBundleFunc mocks the GetBundleContentsForBundle method.
	GetBundleContentsForBundleFunc func(ctx context.Context, bundleID string) (*[]models.ContentItem, error)

	// GetContentItemByBundleIDAndContentItemIDFunc mocks the GetContentItemByBundleIDAndContentItemID method.
	GetContentItemByBundleIDAndContentItemIDFunc func(ctx context.Context, bundleID string, contentItemID string) (*models.ContentItem, error)

	// GetContentItemsByBundleIDFunc mocks the GetContentItemsByBundleID method.
	GetContentItemsByBundleIDFunc func(ctx context.Context, bundleID string) ([]*models.ContentItem, error)

	// ListBundleContentIDsWithoutLimitFunc mocks the ListBundleContentIDsWithoutLimit method.
	ListBundleContentIDsWithoutLimitFunc func(ctx context.Context, bundleID string) ([]*models.ContentItem, error)

	// ListBundleContentsFunc mocks the ListBundleContents method.
	ListBundleContentsFunc func(ctx context.Context, bundleID string, offset int, limit int) ([]*models.ContentItem, int, error)

	// ListBundleEventsFunc mocks the ListBundleEvents method.
	ListBundleEventsFunc func(ctx context.Context, offset int, limit int, bundleID string, after *time.Time, before *time.Time) ([]*models.Event, int, error)

	// ListBundlesFunc mocks the ListBundles method.
	ListBundlesFunc func(ctx context.Context, offset int, limit int, filtersMoqParam *filters.BundleFilters) ([]*models.Bundle, int, error)

	// UpdateBundleFunc mocks the UpdateBundle method.
	UpdateBundleFunc func(ctx context.Context, id string, update *models.Bundle) (*models.Bundle, error)

	// UpdateBundleETagFunc mocks the UpdateBundleETag method.
	UpdateBundleETagFunc func(ctx context.Context, bundleID string, email string) (*models.Bundle, error)

	// UpdateContentItemDatasetInfoFunc mocks the UpdateContentItemDatasetInfo method.
	UpdateContentItemDatasetInfoFunc func(ctx context.Context, contentItemID string, title string, state string) error

	// UpdateContentItemStateFunc mocks the UpdateContentItemState method.
	UpdateContentItemStateFunc func(ctx context.Context, contentItemID string, state string) error
	// contains filtered or unexported fields
}

StorerMock is a mock implementation of store.Storer.

func TestSomethingThatUsesStorer(t *testing.T) {

	// make and configure a mocked store.Storer
	mockedStorer := &StorerMock{
		CheckAllBundleContentsAreApprovedFunc: func(ctx context.Context, bundleID string) (bool, error) {
			panic("mock out the CheckAllBundleContentsAreApproved method")
		},
		CheckBundleExistsFunc: func(ctx context.Context, bundleID string) (bool, error) {
			panic("mock out the CheckBundleExists method")
		},
		CheckBundleExistsByTitleFunc: func(ctx context.Context, title string) (bool, error) {
			panic("mock out the CheckBundleExistsByTitle method")
		},
		CheckBundleExistsByTitleUpdateFunc: func(ctx context.Context, title string, excludeID string) (bool, error) {
			panic("mock out the CheckBundleExistsByTitleUpdate method")
		},
		CheckContentItemExistsByDatasetEditionVersionFunc: func(ctx context.Context, datasetID string, editionID string, versionID int) (bool, error) {
			panic("mock out the CheckContentItemExistsByDatasetEditionVersion method")
		},
		CheckerFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
		CloseFunc: func(ctx context.Context) error {
			panic("mock out the Close method")
		},
		CreateBundleFunc: func(ctx context.Context, bundle *models.Bundle) error {
			panic("mock out the CreateBundle method")
		},
		CreateContentItemFunc: func(ctx context.Context, contentItem *models.ContentItem) error {
			panic("mock out the CreateContentItem method")
		},
		CreateEventFunc: func(ctx context.Context, event *models.Event) error {
			panic("mock out the CreateEvent method")
		},
		DeleteBundleFunc: func(ctx context.Context, id string) error {
			panic("mock out the DeleteBundle method")
		},
		DeleteContentItemFunc: func(ctx context.Context, contentItemID string) error {
			panic("mock out the DeleteContentItem method")
		},
		GetBundleFunc: func(ctx context.Context, bundleID string) (*models.Bundle, error) {
			panic("mock out the GetBundle method")
		},
		GetBundleContentsForBundleFunc: func(ctx context.Context, bundleID string) (*[]models.ContentItem, error) {
			panic("mock out the GetBundleContentsForBundle method")
		},
		GetContentItemByBundleIDAndContentItemIDFunc: func(ctx context.Context, bundleID string, contentItemID string) (*models.ContentItem, error) {
			panic("mock out the GetContentItemByBundleIDAndContentItemID method")
		},
		GetContentItemsByBundleIDFunc: func(ctx context.Context, bundleID string) ([]*models.ContentItem, error) {
			panic("mock out the GetContentItemsByBundleID method")
		},
		ListBundleContentIDsWithoutLimitFunc: func(ctx context.Context, bundleID string) ([]*models.ContentItem, error) {
			panic("mock out the ListBundleContentIDsWithoutLimit method")
		},
		ListBundleContentsFunc: func(ctx context.Context, bundleID string, offset int, limit int) ([]*models.ContentItem, int, error) {
			panic("mock out the ListBundleContents method")
		},
		ListBundleEventsFunc: func(ctx context.Context, offset int, limit int, bundleID string, after *time.Time, before *time.Time) ([]*models.Event, int, error) {
			panic("mock out the ListBundleEvents method")
		},
		ListBundlesFunc: func(ctx context.Context, offset int, limit int, filtersMoqParam *filters.BundleFilters) ([]*models.Bundle, int, error) {
			panic("mock out the ListBundles method")
		},
		UpdateBundleFunc: func(ctx context.Context, id string, update *models.Bundle) (*models.Bundle, error) {
			panic("mock out the UpdateBundle method")
		},
		UpdateBundleETagFunc: func(ctx context.Context, bundleID string, email string) (*models.Bundle, error) {
			panic("mock out the UpdateBundleETag method")
		},
		UpdateContentItemDatasetInfoFunc: func(ctx context.Context, contentItemID string, title string, state string) error {
			panic("mock out the UpdateContentItemDatasetInfo method")
		},
		UpdateContentItemStateFunc: func(ctx context.Context, contentItemID string, state string) error {
			panic("mock out the UpdateContentItemState method")
		},
	}

	// use mockedStorer in code that requires store.Storer
	// and then make assertions.

}

func (*StorerMock) CheckAllBundleContentsAreApproved added in v1.2.0

func (mock *StorerMock) CheckAllBundleContentsAreApproved(ctx context.Context, bundleID string) (bool, error)

CheckAllBundleContentsAreApproved calls CheckAllBundleContentsAreApprovedFunc.

func (*StorerMock) CheckAllBundleContentsAreApprovedCalls added in v1.2.0

func (mock *StorerMock) CheckAllBundleContentsAreApprovedCalls() []struct {
	Ctx      context.Context
	BundleID string
}

CheckAllBundleContentsAreApprovedCalls gets all the calls that were made to CheckAllBundleContentsAreApproved. Check the length with:

len(mockedStorer.CheckAllBundleContentsAreApprovedCalls())

func (*StorerMock) CheckBundleExists added in v1.3.0

func (mock *StorerMock) CheckBundleExists(ctx context.Context, bundleID string) (bool, error)

CheckBundleExists calls CheckBundleExistsFunc.

func (*StorerMock) CheckBundleExistsByTitle added in v1.4.0

func (mock *StorerMock) CheckBundleExistsByTitle(ctx context.Context, title string) (bool, error)

CheckBundleExistsByTitle calls CheckBundleExistsByTitleFunc.

func (*StorerMock) CheckBundleExistsByTitleCalls added in v1.4.0

func (mock *StorerMock) CheckBundleExistsByTitleCalls() []struct {
	Ctx   context.Context
	Title string
}

CheckBundleExistsByTitleCalls gets all the calls that were made to CheckBundleExistsByTitle. Check the length with:

len(mockedStorer.CheckBundleExistsByTitleCalls())

func (*StorerMock) CheckBundleExistsByTitleUpdate added in v1.4.0

func (mock *StorerMock) CheckBundleExistsByTitleUpdate(ctx context.Context, title string, excludeID string) (bool, error)

CheckBundleExistsByTitleUpdate calls CheckBundleExistsByTitleUpdateFunc.

func (*StorerMock) CheckBundleExistsByTitleUpdateCalls added in v1.4.0

func (mock *StorerMock) CheckBundleExistsByTitleUpdateCalls() []struct {
	Ctx       context.Context
	Title     string
	ExcludeID string
}

CheckBundleExistsByTitleUpdateCalls gets all the calls that were made to CheckBundleExistsByTitleUpdate. Check the length with:

len(mockedStorer.CheckBundleExistsByTitleUpdateCalls())

func (*StorerMock) CheckBundleExistsCalls added in v1.3.0

func (mock *StorerMock) CheckBundleExistsCalls() []struct {
	Ctx      context.Context
	BundleID string
}

CheckBundleExistsCalls gets all the calls that were made to CheckBundleExists. Check the length with:

len(mockedStorer.CheckBundleExistsCalls())

func (*StorerMock) CheckContentItemExistsByDatasetEditionVersion added in v1.3.0

func (mock *StorerMock) CheckContentItemExistsByDatasetEditionVersion(ctx context.Context, datasetID string, editionID string, versionID int) (bool, error)

CheckContentItemExistsByDatasetEditionVersion calls CheckContentItemExistsByDatasetEditionVersionFunc.

func (*StorerMock) CheckContentItemExistsByDatasetEditionVersionCalls added in v1.3.0

func (mock *StorerMock) CheckContentItemExistsByDatasetEditionVersionCalls() []struct {
	Ctx       context.Context
	DatasetID string
	EditionID string
	VersionID int
}

CheckContentItemExistsByDatasetEditionVersionCalls gets all the calls that were made to CheckContentItemExistsByDatasetEditionVersion. Check the length with:

len(mockedStorer.CheckContentItemExistsByDatasetEditionVersionCalls())

func (*StorerMock) Checker

func (mock *StorerMock) Checker(ctx context.Context, state *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*StorerMock) CheckerCalls

func (mock *StorerMock) CheckerCalls() []struct {
	Ctx   context.Context
	State *healthcheck.CheckState
}

CheckerCalls gets all the calls that were made to Checker. Check the length with:

len(mockedStorer.CheckerCalls())

func (*StorerMock) Close

func (mock *StorerMock) Close(ctx context.Context) error

Close calls CloseFunc.

func (*StorerMock) CloseCalls

func (mock *StorerMock) CloseCalls() []struct {
	Ctx context.Context
}

CloseCalls gets all the calls that were made to Close. Check the length with:

len(mockedStorer.CloseCalls())

func (*StorerMock) CreateBundle added in v1.4.0

func (mock *StorerMock) CreateBundle(ctx context.Context, bundle *models.Bundle) error

CreateBundle calls CreateBundleFunc.

func (*StorerMock) CreateBundleCalls added in v1.4.0

func (mock *StorerMock) CreateBundleCalls() []struct {
	Ctx    context.Context
	Bundle *models.Bundle
}

CreateBundleCalls gets all the calls that were made to CreateBundle. Check the length with:

len(mockedStorer.CreateBundleCalls())

func (*StorerMock) CreateContentItem added in v1.3.0

func (mock *StorerMock) CreateContentItem(ctx context.Context, contentItem *models.ContentItem) error

CreateContentItem calls CreateContentItemFunc.

func (*StorerMock) CreateContentItemCalls added in v1.3.0

func (mock *StorerMock) CreateContentItemCalls() []struct {
	Ctx         context.Context
	ContentItem *models.ContentItem
}

CreateContentItemCalls gets all the calls that were made to CreateContentItem. Check the length with:

len(mockedStorer.CreateContentItemCalls())

func (*StorerMock) CreateEvent added in v1.10.0

func (mock *StorerMock) CreateEvent(ctx context.Context, event *models.Event) error

CreateEvent calls CreateEventFunc.

func (*StorerMock) CreateEventCalls added in v1.10.0

func (mock *StorerMock) CreateEventCalls() []struct {
	Ctx   context.Context
	Event *models.Event
}

CreateEventCalls gets all the calls that were made to CreateEvent. Check the length with:

len(mockedStorer.CreateEventCalls())

func (*StorerMock) DeleteBundle added in v1.4.0

func (mock *StorerMock) DeleteBundle(ctx context.Context, id string) error

DeleteBundle calls DeleteBundleFunc.

func (*StorerMock) DeleteBundleCalls added in v1.4.0

func (mock *StorerMock) DeleteBundleCalls() []struct {
	Ctx context.Context
	ID  string
}

DeleteBundleCalls gets all the calls that were made to DeleteBundle. Check the length with:

len(mockedStorer.DeleteBundleCalls())

func (*StorerMock) DeleteContentItem added in v1.4.0

func (mock *StorerMock) DeleteContentItem(ctx context.Context, contentItemID string) error

DeleteContentItem calls DeleteContentItemFunc.

func (*StorerMock) DeleteContentItemCalls added in v1.4.0

func (mock *StorerMock) DeleteContentItemCalls() []struct {
	Ctx           context.Context
	ContentItemID string
}

DeleteContentItemCalls gets all the calls that were made to DeleteContentItem. Check the length with:

len(mockedStorer.DeleteContentItemCalls())

func (*StorerMock) GetBundle added in v1.3.0

func (mock *StorerMock) GetBundle(ctx context.Context, bundleID string) (*models.Bundle, error)

GetBundle calls GetBundleFunc.

func (*StorerMock) GetBundleCalls added in v1.3.0

func (mock *StorerMock) GetBundleCalls() []struct {
	Ctx      context.Context
	BundleID string
}

GetBundleCalls gets all the calls that were made to GetBundle. Check the length with:

len(mockedStorer.GetBundleCalls())

func (*StorerMock) GetBundleContentsForBundle added in v1.4.0

func (mock *StorerMock) GetBundleContentsForBundle(ctx context.Context, bundleID string) (*[]models.ContentItem, error)

GetBundleContentsForBundle calls GetBundleContentsForBundleFunc.

func (*StorerMock) GetBundleContentsForBundleCalls added in v1.4.0

func (mock *StorerMock) GetBundleContentsForBundleCalls() []struct {
	Ctx      context.Context
	BundleID string
}

GetBundleContentsForBundleCalls gets all the calls that were made to GetBundleContentsForBundle. Check the length with:

len(mockedStorer.GetBundleContentsForBundleCalls())

func (*StorerMock) GetContentItemByBundleIDAndContentItemID added in v1.4.0

func (mock *StorerMock) GetContentItemByBundleIDAndContentItemID(ctx context.Context, bundleID string, contentItemID string) (*models.ContentItem, error)

GetContentItemByBundleIDAndContentItemID calls GetContentItemByBundleIDAndContentItemIDFunc.

func (*StorerMock) GetContentItemByBundleIDAndContentItemIDCalls added in v1.4.0

func (mock *StorerMock) GetContentItemByBundleIDAndContentItemIDCalls() []struct {
	Ctx           context.Context
	BundleID      string
	ContentItemID string
}

GetContentItemByBundleIDAndContentItemIDCalls gets all the calls that were made to GetContentItemByBundleIDAndContentItemID. Check the length with:

len(mockedStorer.GetContentItemByBundleIDAndContentItemIDCalls())

func (*StorerMock) GetContentItemsByBundleID added in v1.4.0

func (mock *StorerMock) GetContentItemsByBundleID(ctx context.Context, bundleID string) ([]*models.ContentItem, error)

GetContentItemsByBundleID calls GetContentItemsByBundleIDFunc.

func (*StorerMock) GetContentItemsByBundleIDCalls added in v1.4.0

func (mock *StorerMock) GetContentItemsByBundleIDCalls() []struct {
	Ctx      context.Context
	BundleID string
}

GetContentItemsByBundleIDCalls gets all the calls that were made to GetContentItemsByBundleID. Check the length with:

len(mockedStorer.GetContentItemsByBundleIDCalls())

func (*StorerMock) ListBundleContentIDsWithoutLimit added in v1.4.0

func (mock *StorerMock) ListBundleContentIDsWithoutLimit(ctx context.Context, bundleID string) ([]*models.ContentItem, error)

ListBundleContentIDsWithoutLimit calls ListBundleContentIDsWithoutLimitFunc.

func (*StorerMock) ListBundleContentIDsWithoutLimitCalls added in v1.4.0

func (mock *StorerMock) ListBundleContentIDsWithoutLimitCalls() []struct {
	Ctx      context.Context
	BundleID string
}

ListBundleContentIDsWithoutLimitCalls gets all the calls that were made to ListBundleContentIDsWithoutLimit. Check the length with:

len(mockedStorer.ListBundleContentIDsWithoutLimitCalls())

func (*StorerMock) ListBundleContents added in v1.4.0

func (mock *StorerMock) ListBundleContents(ctx context.Context, bundleID string, offset int, limit int) ([]*models.ContentItem, int, error)

ListBundleContents calls ListBundleContentsFunc.

func (*StorerMock) ListBundleContentsCalls added in v1.4.0

func (mock *StorerMock) ListBundleContentsCalls() []struct {
	Ctx      context.Context
	BundleID string
	Offset   int
	Limit    int
}

ListBundleContentsCalls gets all the calls that were made to ListBundleContents. Check the length with:

len(mockedStorer.ListBundleContentsCalls())

func (*StorerMock) ListBundleEvents added in v1.3.0

func (mock *StorerMock) ListBundleEvents(ctx context.Context, offset int, limit int, bundleID string, after *time.Time, before *time.Time) ([]*models.Event, int, error)

ListBundleEvents calls ListBundleEventsFunc.

func (*StorerMock) ListBundleEventsCalls added in v1.3.0

func (mock *StorerMock) ListBundleEventsCalls() []struct {
	Ctx      context.Context
	Offset   int
	Limit    int
	BundleID string
	After    *time.Time
	Before   *time.Time
}

ListBundleEventsCalls gets all the calls that were made to ListBundleEvents. Check the length with:

len(mockedStorer.ListBundleEventsCalls())

func (*StorerMock) ListBundles

func (mock *StorerMock) ListBundles(ctx context.Context, offset int, limit int, filtersMoqParam *filters.BundleFilters) ([]*models.Bundle, int, error)

ListBundles calls ListBundlesFunc.

func (*StorerMock) ListBundlesCalls

func (mock *StorerMock) ListBundlesCalls() []struct {
	Ctx             context.Context
	Offset          int
	Limit           int
	FiltersMoqParam *filters.BundleFilters
}

ListBundlesCalls gets all the calls that were made to ListBundles. Check the length with:

len(mockedStorer.ListBundlesCalls())

func (*StorerMock) UpdateBundle added in v1.4.0

func (mock *StorerMock) UpdateBundle(ctx context.Context, id string, update *models.Bundle) (*models.Bundle, error)

UpdateBundle calls UpdateBundleFunc.

func (*StorerMock) UpdateBundleCalls added in v1.4.0

func (mock *StorerMock) UpdateBundleCalls() []struct {
	Ctx    context.Context
	ID     string
	Update *models.Bundle
}

UpdateBundleCalls gets all the calls that were made to UpdateBundle. Check the length with:

len(mockedStorer.UpdateBundleCalls())

func (*StorerMock) UpdateBundleETag added in v1.3.0

func (mock *StorerMock) UpdateBundleETag(ctx context.Context, bundleID string, email string) (*models.Bundle, error)

UpdateBundleETag calls UpdateBundleETagFunc.

func (*StorerMock) UpdateBundleETagCalls added in v1.3.0

func (mock *StorerMock) UpdateBundleETagCalls() []struct {
	Ctx      context.Context
	BundleID string
	Email    string
}

UpdateBundleETagCalls gets all the calls that were made to UpdateBundleETag. Check the length with:

len(mockedStorer.UpdateBundleETagCalls())

func (*StorerMock) UpdateContentItemDatasetInfo added in v1.4.0

func (mock *StorerMock) UpdateContentItemDatasetInfo(ctx context.Context, contentItemID string, title string, state string) error

UpdateContentItemDatasetInfo calls UpdateContentItemDatasetInfoFunc.

func (*StorerMock) UpdateContentItemDatasetInfoCalls added in v1.4.0

func (mock *StorerMock) UpdateContentItemDatasetInfoCalls() []struct {
	Ctx           context.Context
	ContentItemID string
	Title         string
	State         string
}

UpdateContentItemDatasetInfoCalls gets all the calls that were made to UpdateContentItemDatasetInfo. Check the length with:

len(mockedStorer.UpdateContentItemDatasetInfoCalls())

func (*StorerMock) UpdateContentItemState added in v1.4.0

func (mock *StorerMock) UpdateContentItemState(ctx context.Context, contentItemID string, state string) error

UpdateContentItemState calls UpdateContentItemStateFunc.

func (*StorerMock) UpdateContentItemStateCalls added in v1.4.0

func (mock *StorerMock) UpdateContentItemStateCalls() []struct {
	Ctx           context.Context
	ContentItemID string
	State         string
}

UpdateContentItemStateCalls gets all the calls that were made to UpdateContentItemState. Check the length with:

len(mockedStorer.UpdateContentItemStateCalls())

Jump to

Keyboard shortcuts

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