Documentation
¶
Overview ¶
Package test contains helper functions for unit testing.
Index ¶
- Variables
- func BeBase64() types.GomegaMatcher
- func CreateRecordIndividual(tenantID, role string) (*ingestpb.Record, string)
- func CreateRecordNoProp(externalID, tenantID, nodeType string) *ingestpb.Record
- func CreateRecordRelation(sourceExternalID string, sourceType string, targetExternalID string, ...) *ingestpb.Record
- func CreateRecordResourceNoProp(externalID, nodeType string) *ingestpb.Record
- func DeleteRecord(externalID, nodeType string) *ingestpb.Record
- func DeleteRecordProperty(externalID, nodeType, property string) *ingestpb.Record
- func DeleteRecordRelation(match *ingestpb.RelationMatch) *ingestpb.Record
- func DeleteRecordRelationProperty(match *ingestpb.RelationMatch, property string) *ingestpb.Record
- func EqualAnyProto(expected protoreflect.ProtoMessage) types.GomegaMatcher
- func EqualProto(expected protoreflect.ProtoMessage) types.GomegaMatcher
- func GenerateRandomString(length int) string
- func GetRelationMatch(sourceExternalID string, sourceType string, targetExternalID string, ...) *ingestpb.RelationMatch
- func InitConfigAuthorization() (*authorization.Client, error)
- func InitConfigIngest() (*ingest.Client, error)
- func InitConfigIngestRetry() (*ingest.RetryClient, error)
- func MatchErrorCode(errorCode codes.Code) types.GomegaMatcher
- func MatchJSON(expected any) types.GomegaMatcher
- func MatchProtoMessage(message proto.Message) types.GomegaMatcher
- func MatchStatusError(errorCode codes.Code, msg any) types.GomegaMatcher
- func UpsertRecordAsset() (*ingestpb.Record, string)
- func WrapMatcher(matcher types.GomegaMatcher) gomock.Matcher
- type EqualAnyProtoMatcher
- type EqualProtoMatcher
- type MatchJSONMatcher
- type MatchProtoMessageMatcher
- type MatchSDKStatusErrorMatcher
Constants ¶
This section is empty.
Variables ¶
var ( Resource1 = []*authorizationpb.IsAuthorizedRequest_Resource{ { ExternalId: "wMDazKCQPNEyETp", Type: "Asset", Actions: []string{"SUBSCRIBES_TO"}, }, } Resource2 = []*authorizationpb.IsAuthorizedRequest_Resource{ { ExternalId: "wMDazKCQPNEyETp", Actions: []string{"SUBSCRIBES_TO"}, }, } Resource3 = []*authorizationpb.IsAuthorizedRequest_Resource{ { ExternalId: "wMDazKCQPNEyETp", Type: "Asset", Actions: []string{"DEMANDS"}, }, } Resource4 = []*authorizationpb.IsAuthorizedRequest_Resource{ { ExternalId: "uqGEnybFZhYYpIf", Type: "Asset", Actions: []string{"SUBSCRIBES_TO"}, }, } Resource5 = []*authorizationpb.IsAuthorizedRequest_Resource{ { ExternalId: "qlUxezErcaweWss", Type: "Asset", Actions: []string{"SUBSCRIBES_TO"}, }, } Resource6 = []*authorizationpb.IsAuthorizedRequest_Resource{ { ExternalId: "YPDAQWzzJNlBruc", Type: "Asset", Actions: []string{"SUBSCRIBES_TO"}, }, } Resource7 = []*authorizationpb.IsAuthorizedRequest_Resource{ { ExternalId: "spriFKHyoNJZMjk", Type: "Asset", Actions: []string{"SUBSCRIBES_TO"}, }, } Resource8 = []*authorizationpb.IsAuthorizedRequest_Resource{ { ExternalId: "qVdKKwVYYOHVYSW", Type: "Asset", Actions: []string{"SUBSCRIBES_TO"}, }, } Resource9 = []*authorizationpb.IsAuthorizedRequest_Resource{ { ExternalId: "qVdKKwVYYOHVYSW", Type: "Asset", Actions: []string{"SUBSCRIBES_TO"}, }, { ExternalId: "YlBquyKoVSYflIx", Type: "Asset", Actions: []string{"SUBSCRIBES_TO"}, }, } ResourceType1 = []*authorizationpb.WhatAuthorizedRequest_ResourceType{ {Type: "Asset", Actions: []string{"SUBSCRIBES_TO"}}, } ResourceType2 = []*authorizationpb.WhatAuthorizedRequest_ResourceType{ {Actions: []string{"SUBSCRIBES_TO", "OWNS"}}, } ResourceType3 = []*authorizationpb.WhatAuthorizedRequest_ResourceType{ {Type: "Asset", Actions: []string{"DEMANDS"}}, } ResourceWho1 = []*authorizationpb.WhoAuthorizedRequest_Resource{ {ExternalId: "wMDazKCQPNEyETp", Type: "Asset", Actions: []string{"SUBSCRIBES_TO", "OWNS"}}, } ResourceWho2 = []*authorizationpb.WhoAuthorizedRequest_Resource{ {Type: "Asset", Actions: []string{"SUBSCRIBES_TO", "OWNS"}}, } ResourceWho3 = []*authorizationpb.WhoAuthorizedRequest_Resource{ {ExternalId: "wMDazKCQPNEyETp", Type: "Asset", Actions: []string{"DEMANDS", "REPELS"}}, } DigitalTwinBad = "id" DigitalTwinNotInDB = "gid:AAAAGaiIPzg6L0DKkbIh22crsFg" DigitalTwin1 = "gid:AAAAFcrHH-xwlEAhr_DYdY-Djj0" DigitalTwin2 = "gid:AAAAFeKd8SojW0HrvpmZU8z4aIY" EmailBad = "test@example.com" EmailGood = "colas@yahoo.uk" ExternalIDGood = "bbbSNydqZpeRiGH" Asset1 = "qlUxezErcaweWss" Asset2 = "wMDazKCQPNEyETp" Asset3 = "qVdKKwVYYOHVYSW" Subject1 = "QNcLrJCLGjIbpYO" Subject2 = "bbbSNydqZpeRiGH" Subject3 = "uKcftQKZQfvvGoC" // TokenGoodFormat is a valid format for jwt. TokenGoodFormat = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9." + "eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9." + "dyt0CoTl4WoVjAHI9Q_CwSKhl6d_9rhM3NrXuJttkao" // #nosec G101 TokenBad = "token_invalid_format" WrongTenant = "gid:AAAAA8YwJJujqkUAuTA6pR0AVbM" WrongTenantOtherAppSpace = "gid:AAAAA_2EBAWjakSCo5hf_WIi1oI" )
Functions ¶
func BeBase64 ¶
func BeBase64() types.GomegaMatcher
BeBase64 match string if it is Base64 Standard encoded.
func CreateRecordIndividual ¶ added in v0.18.0
func CreateRecordNoProp ¶ added in v0.18.0
func CreateRecordRelation ¶ added in v0.18.0
func CreateRecordResourceNoProp ¶ added in v0.18.0
func DeleteRecord ¶ added in v0.18.0
func DeleteRecordProperty ¶ added in v0.18.0
func DeleteRecordRelation ¶ added in v0.18.0
func DeleteRecordRelation(match *ingestpb.RelationMatch) *ingestpb.Record
func DeleteRecordRelationProperty ¶ added in v0.18.0
func DeleteRecordRelationProperty(match *ingestpb.RelationMatch, property string) *ingestpb.Record
func EqualAnyProto ¶
func EqualAnyProto(expected protoreflect.ProtoMessage) types.GomegaMatcher
EqualAnyProto uses proto.Equal to compare actual with expected. Equal is strict about types when performing comparisons. It is an error for both actual and expected to be nil. Use BeNil() instead.
func EqualProto ¶
func EqualProto(expected protoreflect.ProtoMessage) types.GomegaMatcher
EqualProto uses proto.Equal to compare actual with expected. Equal is strict about types when performing comparisons. It is an error for both actual and expected to be nil. Use BeNil() instead.
func GenerateRandomString ¶ added in v0.18.0
func GetRelationMatch ¶ added in v0.18.0
func InitConfigAuthorization ¶ added in v0.18.0
func InitConfigAuthorization() (*authorization.Client, error)
InitConfigAuthorization reads in config file and ENV variables if set.
func InitConfigIngest ¶ added in v0.18.0
InitConfigIngest reads in ingest file and ENV variables if set.
func InitConfigIngestRetry ¶ added in v0.18.0
func InitConfigIngestRetry() (*ingest.RetryClient, error)
InitConfigIngestRetry reads in ingest file and ENV variables if set.
func MatchErrorCode ¶
func MatchErrorCode(errorCode codes.Code) types.GomegaMatcher
MatchErrorCode succeeds if actual is a non-nil error that has the code the passed in error.
Error must be google.golang.org/grpc/status.Error It is an error for err to be nil or an object that does not implement the Error interface.
func MatchJSON ¶
func MatchJSON(expected any) types.GomegaMatcher
MatchJSON uses the expected value to build a value matcher.
func MatchProtoMessage ¶
func MatchProtoMessage(message proto.Message) types.GomegaMatcher
MatchProtoMessage succeeds if.
func MatchStatusError ¶
func MatchStatusError(errorCode codes.Code, msg any) types.GomegaMatcher
MatchStatusError succeeds if actual is a non-nil error that has the code the passed in error.
Error must be google.golang.org/grpc/status.Error It is an error for err to be nil or an object that does not implement the Error interface.
func UpsertRecordAsset ¶ added in v0.18.0
func WrapMatcher ¶ added in v0.14.0
func WrapMatcher(matcher types.GomegaMatcher) gomock.Matcher
Types ¶
type EqualAnyProtoMatcher ¶
type EqualAnyProtoMatcher struct { Expected proto.Message // contains filtered or unexported fields }
func (*EqualAnyProtoMatcher) FailureMessage ¶
func (matcher *EqualAnyProtoMatcher) FailureMessage(any) string
func (*EqualAnyProtoMatcher) Match ¶
func (matcher *EqualAnyProtoMatcher) Match(actual any) (bool, error)
func (*EqualAnyProtoMatcher) NegatedFailureMessage ¶
func (matcher *EqualAnyProtoMatcher) NegatedFailureMessage(any) string
type EqualProtoMatcher ¶
func (*EqualProtoMatcher) FailureMessage ¶
func (matcher *EqualProtoMatcher) FailureMessage(actual any) string
func (*EqualProtoMatcher) GomegaString ¶
func (matcher *EqualProtoMatcher) GomegaString() string
func (*EqualProtoMatcher) NegatedFailureMessage ¶
func (matcher *EqualProtoMatcher) NegatedFailureMessage(actual any) string
type MatchJSONMatcher ¶
type MatchJSONMatcher struct {
types.GomegaMatcher
}
type MatchProtoMessageMatcher ¶
func (*MatchProtoMessageMatcher) FailureMessage ¶
func (matcher *MatchProtoMessageMatcher) FailureMessage(actual any) string
func (*MatchProtoMessageMatcher) Match ¶
func (matcher *MatchProtoMessageMatcher) Match(actual any) (bool, error)
func (*MatchProtoMessageMatcher) NegatedFailureMessage ¶
func (matcher *MatchProtoMessageMatcher) NegatedFailureMessage(actual any) string
type MatchSDKStatusErrorMatcher ¶
type MatchSDKStatusErrorMatcher struct { Expected codes.Code // contains filtered or unexported fields }
func (*MatchSDKStatusErrorMatcher) FailureMessage ¶
func (matcher *MatchSDKStatusErrorMatcher) FailureMessage(actual any) string
func (*MatchSDKStatusErrorMatcher) Match ¶
func (matcher *MatchSDKStatusErrorMatcher) Match(actual any) (bool, error)
func (*MatchSDKStatusErrorMatcher) NegatedFailureMessage ¶
func (matcher *MatchSDKStatusErrorMatcher) NegatedFailureMessage(actual any) string
Directories
¶
Path | Synopsis |
---|---|
authorization
|
|
v1beta1
Code generated by MockGen.
|
Code generated by MockGen. |
config
|
|
v1beta1
Code generated by MockGen.
|
Code generated by MockGen. |
identity
|
|
v1beta2
Code generated by MockGen.
|
Code generated by MockGen. |
ingest
|
|
v1beta2
Code generated by MockGen.
|
Code generated by MockGen. |
knowledge
|
|
v1beta1
Code generated by MockGen.
|
Code generated by MockGen. |