test

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package test is a test helper for the other packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CmpSlice

func CmpSlice(a, b []string) bool

CmpSlice checks, if slice a and b holds the same values.

func RestrictAllowed

func RestrictAllowed(getter datastore.Getter, uid int) datastore.Getter

RestrictAllowed is a restricter that allows everything

func RestrictNotAllowed

func RestrictNotAllowed(getter datastore.Getter, uid int) datastore.Getter

RestrictNotAllowed is a restricter that removes everythin

func Str

func Str(keys ...string) []string

Str builds a slice of strings.

Types

type Auth

type Auth int

Auth implements the http.Authenticater interface. It allways returs the given user id.

func (Auth) Authenticate

func (a Auth) Authenticate(w http.ResponseWriter, r *http.Request) (context.Context, error)

Authenticate does nothing.

func (Auth) FromContext

func (a Auth) FromContext(ctx context.Context) int

FromContext returns the uid the object was initialiced with.

type KeysBuilder

type KeysBuilder struct {
	K []string
}

KeysBuilder is a mock that impelements the autoupdate.KeysBuilder interface.

func (KeysBuilder) Keys

func (m KeysBuilder) Keys() []string

Keys returns the keys from the mock.

func (KeysBuilder) Update

Update does nothing.

type MockPermission

type MockPermission struct {
	Data    map[string]bool
	Called  map[string]bool
	Default bool
	// contains filtered or unexported fields
}

MockPermission mocks the permission api.

func (*MockPermission) RestrictFQFields

func (p *MockPermission) RestrictFQFields(ctx context.Context, uid int, fqids []string) (map[string]bool, error)

RestrictFQFields returns the fields where p.Data is true.

Jump to

Keyboard shortcuts

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