testfixtures

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DocumentNS = ns.Namespace(
	"document",
	ns.Relation("owner",
		nil,
		ns.RelationReference("user", "..."),
	),
	ns.Relation("editor",
		ns.Union(
			ns.This(),
			ns.ComputedUserset("owner"),
		),
		ns.RelationReference("user", "..."),
	),
	ns.Relation("parent", nil, ns.RelationReference("folder", "...")),
	ns.Relation("lock", nil),
	ns.Relation("viewer",
		ns.Union(
			ns.This(),
			ns.ComputedUserset("editor"),
			ns.TupleToUserset("parent", "viewer"),
		),
		ns.RelationReference("user", "..."),
	),
	ns.Relation("viewer_and_editor",
		ns.Intersection(
			ns.This(),
			ns.ComputedUserset("editor"),
		),
		ns.RelationReference("user", "..."),
	),
	ns.Relation("viewer_and_editor_derived",
		ns.Union(
			ns.This(),
			ns.ComputedUserset("viewer_and_editor"),
		),
		ns.RelationReference("user", "..."),
	),
)
View Source
var FolderNS = ns.Namespace(
	"folder",
	ns.Relation("owner",
		nil,
		ns.RelationReference("user", "..."),
	),
	ns.Relation("parent", nil, ns.RelationReference("folder", "...")),
	ns.Relation("editor",
		ns.Union(
			ns.This(),
			ns.ComputedUserset("owner"),
		),
		ns.RelationReference("user", "..."),
	),
	ns.Relation("viewer",
		ns.Union(
			ns.This(),
			ns.ComputedUserset("editor"),
			ns.TupleToUserset("parent", "viewer"),
		),
		ns.RelationReference("user", "..."),
		ns.RelationReference("folder", "viewer"),
	),
)
View Source
var StandardTuples = []string{
	"document:companyplan#parent@folder:company#...",
	"document:masterplan#parent@folder:strategy#...",
	"folder:strategy#parent@folder:company#...",
	"folder:company#owner@user:owner#...",
	"folder:company#viewer@user:legal#...",
	"folder:strategy#owner@user:vp_product#...",
	"document:masterplan#owner@user:product_manager#...",
	"document:masterplan#viewer@user:eng_lead#...",
	"document:masterplan#parent@folder:plans#...",
	"folder:plans#viewer@user:chief_financial_officer#...",
	"folder:auditors#viewer@user:auditor#...",
	"folder:company#viewer@folder:auditors#viewer",
	"document:healthplan#parent@folder:plans#...",
	"folder:isolated#viewer@user:villain#...",
	"document:specialplan#viewer_and_editor@user:multiroleguy#...",
	"document:specialplan#editor@user:multiroleguy#...",
	"document:specialplan#viewer_and_editor@user:missingrolegal#...",
}
View Source
var UserNS = ns.Namespace("user")

Functions

func NewTestServer added in v0.0.2

func NewTestServer() *grpc.Server

NewTestServer creates a grpc.Server instance that has the service specific interceptor running middleware preinstalled.

func NewValidatingDatastore added in v0.0.2

func NewValidatingDatastore(delegate datastore.Datastore) datastore.Datastore

NewValidatingDatastore creates a proxy which runs validation on all call parameters before passing the call onward.

func StandardDatastoreWithSchema

func StandardDatastoreWithSchema(ds datastore.Datastore, require *require.Assertions) (datastore.Datastore, datastore.Revision)

Types

type TupleChecker

type TupleChecker struct {
	Require *require.Assertions
	DS      datastore.Datastore
}

func (TupleChecker) ExactTupleIterator

func (tc TupleChecker) ExactTupleIterator(ctx context.Context, tpl *v0.RelationTuple, rev datastore.Revision) datastore.TupleIterator

func (TupleChecker) NoTupleExists

func (tc TupleChecker) NoTupleExists(ctx context.Context, tpl *v0.RelationTuple, rev datastore.Revision)

func (TupleChecker) TupleExists

func (tc TupleChecker) TupleExists(ctx context.Context, tpl *v0.RelationTuple, rev datastore.Revision)

func (TupleChecker) VerifyIteratorCount

func (tc TupleChecker) VerifyIteratorCount(iter datastore.TupleIterator, count int)

func (TupleChecker) VerifyIteratorResults

func (tc TupleChecker) VerifyIteratorResults(iter datastore.TupleIterator, tpls ...*v0.RelationTuple)

Jump to

Keyboard shortcuts

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