test

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package test contains helper functions for unit testing.

Index

Constants

This section is empty.

Variables

View Source
var (
	Resource1 = []*authorizationpb.IsAuthorizedRequest_Resource{
		{
			ExternalId: "pFlpMtkWqCPXVue",
			Type:       "Asset",
			Actions:    []string{"SUBSCRIBES_TO"},
		},
	}

	Resource2 = []*authorizationpb.IsAuthorizedRequest_Resource{
		{
			ExternalId: "pFlpMtkWqCPXVue",
			Actions:    []string{"SUBSCRIBES_TO"},
		},
	}

	Resource3 = []*authorizationpb.IsAuthorizedRequest_Resource{
		{
			ExternalId: "pFlpMtkWqCPXVue",
			Type:       "Asset",
			Actions:    []string{"DEMANDS"},
		},
	}

	Resource4 = []*authorizationpb.IsAuthorizedRequest_Resource{
		{
			ExternalId: "QovektcrVBbNmFj",
			Type:       "Asset",
			Actions:    []string{"SUBSCRIBES_TO"},
		},
	}

	Resource5 = []*authorizationpb.IsAuthorizedRequest_Resource{
		{
			ExternalId: "HQKzkgPnGJDiaGo",
			Type:       "Asset",
			Actions:    []string{"SUBSCRIBES_TO"},
		},
	}

	Resource6 = []*authorizationpb.IsAuthorizedRequest_Resource{
		{
			ExternalId: "XcbZruEzGNYHLic",
			Type:       "Asset",
			Actions:    []string{"SUBSCRIBES_TO"},
		},
	}

	Resource7 = []*authorizationpb.IsAuthorizedRequest_Resource{
		{
			ExternalId: "zIDegSbXcRlBeFZ",
			Type:       "Asset",
			Actions:    []string{"SUBSCRIBES_TO"},
		},
	}

	Resource8 = []*authorizationpb.IsAuthorizedRequest_Resource{
		{
			ExternalId: "paLtQSpEcTvzeuC",
			Type:       "Asset",
			Actions:    []string{"SUBSCRIBES_TO"},
		},
	}

	Resource9 = []*authorizationpb.IsAuthorizedRequest_Resource{
		{
			ExternalId: "pFlpMtkWqCPXVue",
			Type:       "Asset",
			Actions:    []string{"SUBSCRIBES_TO"},
		},
		{
			ExternalId: "HQKzkgPnGJDiaGo",
			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: "pFlpMtkWqCPXVue", Type: "Asset", Actions: []string{"SUBSCRIBES_TO", "OWNS"}},
	}

	ResourceWho2 = []*authorizationpb.WhoAuthorizedRequest_Resource{
		{Type: "Asset", Actions: []string{"SUBSCRIBES_TO", "OWNS"}},
	}

	ResourceWho3 = []*authorizationpb.WhoAuthorizedRequest_Resource{
		{ExternalId: "pFlpMtkWqCPXVue", Type: "Asset", Actions: []string{"DEMANDS", "REPELS"}},
	}

	NodeBad     = "id"
	NodeNotInDB = "gid:AAAAGaiIPzg6L0DKkbIh22crsFg"
	Node1       = "gid:AAAAFdrC00gBhkvelHM0OQO-u4U"
	Node2       = "gid:AAAAFb3lFaaArUVYqk9VdY1Ct1Y"
	Node3       = "gid:AAAAHNdVLTx1-ExZnjv7nVyRiQc"
	Node4       = "gid:AAAAHC_gEo51KUkbvMdGenKHc6Q"
	Node5       = "gid:AAAAHKOnVUXFSEe5gSqzl0fOHoU"

	EmailBad   = "test@example.com"
	EmailGood  = "biche@yahoo.uk"
	EmailGood2 = "darna@yahoo.uk"

	ExternalIDGood = "TrSFiLuoSLGiCIo"

	Asset1  = "HQKzkgPnGJDiaGo"
	Asset2  = "pFlpMtkWqCPXVue"
	Asset3  = "zojWwtKbBLmAXCO"
	Asset4  = "paLtQSpEcTvzeuC"
	Asset5  = "dLZVTSllFCdZfXC"
	Car1    = "gid:AAAAHGFc4HM1TUg8oRiWIsQsVz8"
	Car1Ext = "9658744"
	Car2    = "gid:AAAAHFLO98h-sEakqs0Qnvpkqq8"
	Car2Ext = "963258"

	Subject1   = "dilZWYdFcmXiojC"
	Subject2   = "fVcaUxJqmOkyOTX"
	Subject3   = "lSPmCXIPRXppszf"
	Subject4   = "NACTFFKUCcceDIz"
	SubjectDT4 = "852147963"
	SubjectDT5 = "741258"

	ConsentConfigID = "gid:AAAAHfho2CFLq0rWpmSapJj0JHY"
	ConsentConfig2  = "gid:AAAAHY0vIMaQx0J9mznHhmarV0M"
	ConsentConfig3  = "gid:AAAAHcghAxMMo0vBjxi4IpZgsjQ"
	Application     = "gid:AAAABMoo7PXYfkwepSVjj4GTtfc"
	ConsentInvalid  = "gid:AAAAHQlNWOqosEpOuI7iyJ46Lhc"
	ConsentEnforce  = "gid:AAAAHZqv2OcINERSmJxWdp_Zdx4"
	ConsentAllow    = "gid:AAAAHf5ZnwufDUK-tnCjoSsw-cQ"
)

Functions

func BatchNodesMatch added in v0.30.1

func BatchNodesMatch(
	nodeMatch *ingestpb.NodeMatch, nodeMatch2 *ingestpb.NodeMatch) []*ingestpb.NodeMatch

func BatchNodesType added in v0.30.1

func BatchNodesType(
	typeNode string) ([]*knowledgeobjects.Node, string, string)

func BatchRelationships added in v0.30.1

func BatchRelationships(
	relationship *ingestpb.Relationship, relationship2 *ingestpb.Relationship) []*ingestpb.Relationship

func BeBase64

func BeBase64() types.GomegaMatcher

BeBase64 match string if it is Base64 Standard encoded.

func CreateBatchNodeMatch added in v0.30.1

func CreateBatchNodeMatch(
	externalID string, typeNode string) *ingestpb.NodeMatch

func CreateBatchNodes added in v0.30.1

func CreateBatchNodes(
	typeNode string) (*knowledgeobjects.Node, string)

func CreateRecordNoProperty added in v0.23.0

func CreateRecordNoProperty(externalID, nodeType string) *ingestpb.Record

func CreateRecordNodeIndividual added in v0.23.0

func CreateRecordNodeIndividual(
	role string) (*ingestpb.Record, string)

func CreateRecordRelationship added in v0.23.0

func CreateRecordRelationship(
	sourceExternalID string,
	sourceType string,
	targetExternalID string,
	targetType string,
	relationType string) *ingestpb.Record

func CreateRecordResourceNoProperty added in v0.23.0

func CreateRecordResourceNoProperty(externalID, nodeType string) *ingestpb.Record

func DeleteRecord added in v0.18.0

func DeleteRecord(externalID, nodeType string) *ingestpb.Record

func DeleteRecordRelationship added in v0.23.0

func DeleteRecordRelationship(relationship *ingestpb.Relationship) *ingestpb.Record

func DeleteRecordRelationshipProperty added in v0.23.0

func DeleteRecordRelationshipProperty(
	sourceExternalID string,
	sourceType string,
	targetExternalID string,
	targetType string,
	typeRelation string,
	propertyType string) *ingestpb.Record

func DeleteRecordWithProperty added in v0.23.0

func DeleteRecordWithProperty(externalID, nodeType, 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 GenerateRandomString(length int) string

func GetRelationship added in v0.23.0

func GetRelationship(
	sourceExternalID string,
	sourceType string,
	targetExternalID string,
	targetType string,
	relationType string) *ingestpb.Relationship

func InitConfigAuthorization added in v0.18.0

func InitConfigAuthorization() (*authorization.Client, error)

InitConfigAuthorization reads in config file and ENV variables if set.

func InitConfigConfig added in v0.25.0

func InitConfigConfig() (*config.Client, error)

InitConfigConfig file and ENV variables if set.

func InitConfigIngest added in v0.18.0

func InitConfigIngest() (*ingest.Client, error)

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 InitConfigTda added in v0.30.1

func InitConfigTda() (*tda.Client, error)

InitConfigTda reads in tda 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 UpsertRecordNodeAsset added in v0.23.0

func UpsertRecordNodeAsset() (*ingestpb.Record, string)

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

type EqualProtoMatcher struct {
	Expected proto.Message
}

func (*EqualProtoMatcher) FailureMessage

func (matcher *EqualProtoMatcher) FailureMessage(actual any) string

func (*EqualProtoMatcher) GomegaString

func (matcher *EqualProtoMatcher) GomegaString() string

func (*EqualProtoMatcher) Match

func (matcher *EqualProtoMatcher) Match(actual any) (bool, error)

func (*EqualProtoMatcher) NegatedFailureMessage

func (matcher *EqualProtoMatcher) NegatedFailureMessage(actual any) string

type MatchJSONMatcher

type MatchJSONMatcher struct {
	types.GomegaMatcher
}

func (*MatchJSONMatcher) Match

func (matcher *MatchJSONMatcher) Match(actual any) (bool, error)

type MatchProtoMessageMatcher

type MatchProtoMessageMatcher struct {
	Expected proto.Message
}

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
Package authorization is a generated GoMock package.
Package authorization is a generated GoMock package.
config
v1beta1
Package config is a generated GoMock package.
Package config is a generated GoMock package.
ingest
v1beta2
Package ingest is a generated GoMock package.
Package ingest is a generated GoMock package.
v1beta3
Package ingest is a generated GoMock package.
Package ingest is a generated GoMock package.
knowledge
v1beta1
Package knowledge is a generated GoMock package.
Package knowledge is a generated GoMock package.
v1beta2
Package knowledge is a generated GoMock package.
Package knowledge is a generated GoMock package.
tda
v1beta1
Package tda is a generated GoMock package.
Package tda is a generated GoMock package.

Jump to

Keyboard shortcuts

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