mocks

package
v1.51.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: BSD-2-Clause Imports: 28 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	MockAnnoSearchStrainID = "DBS0235559"
)

Shared fixture literals, named because golangci-lint goconst requires repeated string literals to be declared as constants.

View Source
const (
	MockStockSearchID = "DBS0236126"
)

MockStockSearchID is the stock_id carried by the search result fixtures below.

Variables

View Source
var (
	MockSysNameAnno   = MockTagAnno(annotatedEntryID, registry.SysnameTag)
	MockGenModAnno    = MockTagAnno("exogenous mutation", registry.MuttypeTag)
	MockMutMethodAnno = MockTagAnno("Random Insertion", registry.MutmethodTag)
)
View Source
var ContentTimestamp = timestamppb.New(time.Date(2020, time.January, 1, 1, 0, 0, 0, time.UTC))
View Source
var MockContentAttributes = &content.ContentAttributes{
	Name:      "test-page",
	Slug:      "news-test-page",
	CreatedBy: createdByEmail,
	UpdatedBy: updatedByEmail,
	CreatedAt: ContentTimestamp,
	UpdatedAt: ContentTimestamp,
	Content:   "test content body",
	Namespace: "news",
}
View Source
var MockGenotypeAnno = MockTagAnno(
	"axeA1,axeB1,axeC1,sadA-[sadA-KO],[pSadA-GFP],bsR,neoR",
	registry.GenoTag,
)
View Source
var MockInStockAnno = MockTagAnno(annotatedEntryID, registry.SysnameTag)
View Source
var MockOrderAttributes = &order.OrderAttributes{
	CreatedAt:        timestamppb.Now(),
	UpdatedAt:        timestamppb.Now(),
	Courier:          "USPS",
	CourierAccount:   "123456",
	Comments:         "first order",
	Payment:          "credit",
	PurchaseOrderNum: "987654",
	Status:           0,
	Consumer:         "art@vandelayindustries.com",
	Payer:            "george@costanza.com",
	Purchaser:        "thatsgold@jerry.org",
	Items:            []string{"DBS123456"},
}
View Source
var MockPlasmidAttributes = &stock.PlasmidAttributes{
	CreatedAt:       StockTimestamp,
	UpdatedAt:       StockTimestamp,
	CreatedBy:       createdByEmail,
	UpdatedBy:       createdByEmail,
	Summary:         "test summary",
	EditableSummary: "editable test summary",
	Genes:           []string{"DDB_G0285425"},
	Dbxrefs:         []string{dbxrefTest},
	Publications:    []string{"99999"},
	ImageMap:        "https://eric.dictybase.dev/test.jpg",
	Sequence:        "ABCDEF",
	Name:            plasmidName,
}
View Source
var MockStrainAttributes = &stock.StrainAttributes{
	CreatedAt:       StockTimestamp,
	UpdatedAt:       StockTimestamp,
	CreatedBy:       createdByEmail,
	UpdatedBy:       createdByEmail,
	Summary:         "test summary",
	EditableSummary: "editable test summary",
	Depositor:       "kenny@bania.com",
	Genes:           []string{"DDB_G0285425"},
	Dbxrefs:         []string{dbxrefTest},
	Publications:    []string{"99999"},
	Label:           "test99",
	Species:         "human",
	Plasmid:         plasmidName,
	Names:           []string{"fusilli"},
}
View Source
var MockUpdatePlasmidAttributes = &stock.PlasmidAttributes{
	CreatedAt:       StockTimestamp,
	UpdatedAt:       StockTimestamp,
	CreatedBy:       createdByEmail,
	UpdatedBy:       updatedByEmail,
	Summary:         "updated summary",
	EditableSummary: "editable updated summary",
	Depositor:       "puddy@nyrangers.com",
	Genes:           []string{"sadA"},
	Dbxrefs:         []string{dbxrefTest},
	Publications:    []string{"99999"},
	ImageMap:        "https://eric.dictybase.dev/test.jpg",
	Sequence:        "ABCDEF",
	Name:            plasmidName,
}
View Source
var MockUpdateStrainAttributes = &stock.StrainAttributes{
	CreatedAt:       StockTimestamp,
	UpdatedAt:       StockTimestamp,
	CreatedBy:       createdByEmail,
	UpdatedBy:       updatedByEmail,
	Summary:         "updated summary",
	EditableSummary: "editable updated summary",
	Depositor:       "puddy@nyrangers.com",
	Genes:           []string{"sadA"},
	Dbxrefs:         []string{dbxrefTest},
	Publications:    []string{"99999"},
	Label:           "test99",
	Species:         "human",
	Plasmid:         plasmidName,
	Names:           []string{"fusilli"},
}
View Source
var (
	StockTimestamp = timestamppb.New(t)
)

Functions

func MockAnnotationSearchResultCollection

func MockAnnotationSearchResultCollection() *annotation.AnnotationSearchResultCollection

func MockAnnotationSuggestionCollection

func MockAnnotationSuggestionCollection() *annotation.AnnotationSuggestionCollection

func MockBacterialAnnoEntry

func MockBacterialAnnoEntry(id string) *annotation.TaggedAnnotationCollection_Data

MockBacterialAnnoEntry creates one "bacterial food source" annotation entry.

func MockBacterialStrainListAnno

func MockBacterialStrainListAnno() *annotation.TaggedAnnotationCollection

MockBacterialStrainListAnno returns two distinct IDs plus one duplicate to exercise deduplication in the bacterial pipeline. After deduplication: [DBS000001, DBS000002]

func MockCharacteristicsAnno

func MockCharacteristicsAnno() *annotation.TaggedAnnotationCollection

func MockContentCollection

func MockContentCollection() *content.ContentCollection

func MockEmptyPhenotypeSearchResultCollection added in v1.48.0

func MockEmptyPhenotypeSearchResultCollection() *annotation.PhenotypeSearchResultCollection

MockEmptyPhenotypeSearchResultCollection returns a valid empty phenotype search answer.

func MockPhenoCollectionAnno

func MockPhenoCollectionAnno(
	tag, id string,
) *annotation.TaggedAnnotationCollection_Data

MockPhenoCollectionAnno is used to test the ListStrainsWithPhenotype method.

func MockPhenotypeListAnno

func MockPhenotypeListAnno() *annotation.TaggedAnnotationCollection

func MockPhenotypeSearchResultCollection added in v1.48.0

func MockPhenotypeSearchResultCollection() *annotation.PhenotypeSearchResultCollection

MockPhenotypeSearchResultCollection returns two ranked phenotype search rows over distinct strain entries. It reuses the stock search id constant and the shared delayedCulmination constant, so the mocks package holds each literal once.

func MockPlasmidCollection

func MockPlasmidCollection() *stock.PlasmidCollection

func MockPlasmidInputWithParams

func MockPlasmidInputWithParams(depositor string) *stock.PlasmidAttributes

func MockSearchStrainList

func MockSearchStrainList() *stock.StrainList

func MockStockSearchResultCollection

func MockStockSearchResultCollection() *stock.StockSearchResultCollection

func MockStockSuggestionCollection

func MockStockSuggestionCollection() *stock.StockSuggestionCollection

func MockStrain

func MockStrain() *stock.Strain

func MockStrainCollection

func MockStrainCollection() *stock.StrainCollection

func MockStrainInputWithParams

func MockStrainInputWithParams(
	depositor, parent string,
) *stock.StrainAttributes

func MockStrainList

func MockStrainList() *stock.StrainList

func MockTagAnno

func MockTagAnno(value, tag string) *annotation.TaggedAnnotation

func MockTagGroupAnno

func MockTagGroupAnno(
	onto, tag, value string,
) *annotation.TaggedAnnotationGroup_Data

func MockTagList

func MockTagList(
	onto, tag, value string,
) *annotation.TaggedAnnotationCollection_Data

func MockedAnnotationClient

func MockedAnnotationClient() *clients.TaggedAnnotationServiceClient

func MockedAuthClient

func MockedAuthClient() authentication.LogtoClient

func MockedCharacteristicsClient

func MockedCharacteristicsClient() *clients.TaggedAnnotationServiceClient

func MockedContentClient

func MockedContentClient() *clients.ContentServiceClient

func MockedGenotypeClient

func MockedGenotypeClient() *clients.TaggedAnnotationServiceClient

func MockedIdentityClient

func MockedIdentityClient() *clients.IdentityServiceClient

func MockedInStockClient

func MockedInStockClient() *clients.TaggedAnnotationServiceClient

func MockedInStockErrorClient

func MockedInStockErrorClient() *clients.TaggedAnnotationServiceClient

MockedInStockErrorClient fails the inventory lookup with an internal error.

func MockedMutMethodClient

func MockedMutMethodClient() *clients.TaggedAnnotationServiceClient

func MockedNotInStockClient

func MockedNotInStockClient() *clients.TaggedAnnotationServiceClient

MockedNotInStockClient answers the inventory lookup with not-found.

func MockedOrderClient

func MockedOrderClient() *clients.OrderServiceClient

func MockedPermissionClient

func MockedPermissionClient() *clients.PermissionServiceClient

func MockedPhenotypeClient

func MockedPhenotypeClient() *clients.TaggedAnnotationServiceClient

func MockedRoleClient

func MockedRoleClient() *clients.RoleServiceClient

func MockedStockClient

func MockedStockClient() *clients.StockServiceClient

func MockedSysNameAnnoClient

func MockedSysNameAnnoClient() *clients.TaggedAnnotationServiceClient

func MockedUserClient

func MockedUserClient() *clients.UserServiceClient

func TestLogger

func TestLogger() *logrus.Entry

Types

type HistoryRepository added in v1.50.0

type HistoryRepository struct {
	Err     error
	Members []repository.ScoredMember
	ReadErr error

	Calls      []RecentMemberCall
	ReadCounts []int64
	// contains filtered or unexported fields
}

HistoryRepository is a repository.Repository fake that records AddRecentMember calls and returns Err from them. RecentMembers records each count in ReadCounts, returns ReadErr when it is set, and otherwise returns the first count items of Members. All other methods return zero values.

func (*HistoryRepository) AddRecentMember added in v1.50.0

func (h *HistoryRepository) AddRecentMember(
	key, member string,
	score, capacity int64,
) error

AddRecentMember records the call under the mutex and returns Err.

func (*HistoryRepository) Exists added in v1.50.0

func (h *HistoryRepository) Exists(string) (bool, error)

func (*HistoryRepository) Get added in v1.50.0

func (h *HistoryRepository) Get(string) (string, error)

func (*HistoryRepository) HExists added in v1.50.0

func (h *HistoryRepository) HExists(string, string) (bool, error)

func (*HistoryRepository) HGet added in v1.50.0

func (*HistoryRepository) HSet added in v1.50.0

func (*HistoryRepository) RecentMembers added in v1.50.0

func (h *HistoryRepository) RecentMembers(
	_ string,
	count int64,
) ([]repository.ScoredMember, error)

RecentMembers records the count and returns ReadErr or the first count items of Members.

func (*HistoryRepository) Set added in v1.50.0

func (*HistoryRepository) SetWithTTL added in v1.50.0

func (h *HistoryRepository) SetWithTTL(
	string, string, time.Duration,
) error

type MockRegistry

type MockRegistry struct {
	ConnMap *hashmap.Map
}

func (*MockRegistry) AddAPIConnection

func (mr *MockRegistry) AddAPIConnection(key string, conn *grpc.ClientConn)

func (*MockRegistry) AddAPIEndpoint

func (mr *MockRegistry) AddAPIEndpoint(key, endpoint string)

func (*MockRegistry) AddAuthClient

func (mr *MockRegistry) AddAuthClient(
	key string, auth authentication.LogtoClient,
)

func (*MockRegistry) AddRecord

func (mr *MockRegistry) AddRecord(key, value string)

func (*MockRegistry) AddRepository

func (mr *MockRegistry) AddRepository(key string, st repository.Repository)

func (*MockRegistry) AddS3Client

func (mr *MockRegistry) AddS3Client(key string, s3c *minio.Client)

func (*MockRegistry) GetAPIConnection

func (mr *MockRegistry) GetAPIConnection(key string) (conn *grpc.ClientConn)

GetAPIClient looks up a client in the hashmap

func (MockRegistry) GetAPIEndpoint

func (mr MockRegistry) GetAPIEndpoint(key string) string

func (*MockRegistry) GetAnnotationClient

func (mr *MockRegistry) GetAnnotationClient(
	key string,
) annotation.TaggedAnnotationServiceClient

func (*MockRegistry) GetAuthClient

func (mr *MockRegistry) GetAuthClient(key string) authentication.LogtoClient

func (*MockRegistry) GetContentClient

func (mr *MockRegistry) GetContentClient(
	key string,
) content.ContentServiceClient

func (*MockRegistry) GetFeatAnnotationClient

func (mr *MockRegistry) GetFeatAnnotationClient(
	name string,
) feature.FeatureAnnotationServiceClient

GetFeatAnnotationClient provides a mock function with given fields: name

func (*MockRegistry) GetIdentityClient

func (mr *MockRegistry) GetIdentityClient(
	key string,
) identity.IdentityServiceClient

func (*MockRegistry) GetOrderClient

func (mr *MockRegistry) GetOrderClient(key string) order.OrderServiceClient

func (*MockRegistry) GetPermissionClient

func (mr *MockRegistry) GetPermissionClient(
	key string,
) user.PermissionServiceClient

func (*MockRegistry) GetRecord

func (mr *MockRegistry) GetRecord(key string) string

func (MockRegistry) GetRedisRepository

func (mr MockRegistry) GetRedisRepository(key string) repository.Repository

func (*MockRegistry) GetRoleClient

func (mr *MockRegistry) GetRoleClient(key string) user.RoleServiceClient

func (*MockRegistry) GetS3Client

func (mr *MockRegistry) GetS3Client(key string) *minio.Client

func (*MockRegistry) GetStockClient

func (mr *MockRegistry) GetStockClient(key string) stock.StockServiceClient

func (*MockRegistry) GetUserClient

func (mr *MockRegistry) GetUserClient(key string) user.UserServiceClient

func (*MockRegistry) ServiceMap

func (mr *MockRegistry) ServiceMap() map[string]string

type RecentMemberCall added in v1.50.0

type RecentMemberCall struct {
	Key      string
	Member   string
	Score    int64
	Capacity int64
}

RecentMemberCall records one AddRecentMember call.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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