Documentation ¶
Overview ¶
Package storetest contains cli specific store interfaces and functionality
Index ¶
- Constants
- func RunSingleLocalCheckTest(fgaServer *server.Server, checkRequest *pb.CheckRequest) (*pb.CheckResponse, error)
- func RunSingleLocalListObjectsTest(fgaServer *server.Server, listObjectsRequest *pb.ListObjectsRequest) (*pb.ListObjectsResponse, error)
- func RunSingleLocalListUsersTest(fgaServer *server.Server, listUsersRequest *pb.ListUsersRequest) (*pb.ListUsersResponse, error)
- type ModelTest
- type ModelTestCheck
- type ModelTestCheckSingleResult
- func RunLocalCheckTest(fgaServer *server.Server, checkTest ModelTestCheck, ...) []ModelTestCheckSingleResult
- func RunRemoteCheckTest(fgaClient *client.OpenFgaClient, checkTest ModelTestCheck, ...) []ModelTestCheckSingleResult
- func RunSingleRemoteCheckTest(fgaClient *client.OpenFgaClient, checkRequest client.ClientCheckRequest, ...) ModelTestCheckSingleResult
- type ModelTestListObjects
- type ModelTestListObjectsSingleResult
- func RunLocalListObjectsTest(fgaServer *server.Server, listObjectsTest ModelTestListObjects, ...) []ModelTestListObjectsSingleResult
- func RunRemoteListObjectsTest(fgaClient *client.OpenFgaClient, listObjectsTest ModelTestListObjects, ...) []ModelTestListObjectsSingleResult
- func RunSingleRemoteListObjectsTest(fgaClient *client.OpenFgaClient, ...) ModelTestListObjectsSingleResult
- type ModelTestListUsers
- type ModelTestListUsersAssertion
- type ModelTestListUsersSingleResult
- func RunLocalListUsersTest(fgaServer *server.Server, listUsersTest ModelTestListUsers, ...) []ModelTestListUsersSingleResult
- func RunRemoteListUsersTest(fgaClient *client.OpenFgaClient, listUsersTest ModelTestListUsers, ...) []ModelTestListUsersSingleResult
- func RunSingleRemoteListUsersTest(fgaClient *client.OpenFgaClient, ...) ModelTestListUsersSingleResult
- type ModelTestOptions
- type StoreData
- type TestResult
- type TestResults
Constants ¶
View Source
const NoValueString = "N/A"
Variables ¶
This section is empty.
Functions ¶
func RunSingleLocalCheckTest ¶
func RunSingleLocalCheckTest( fgaServer *server.Server, checkRequest *pb.CheckRequest, ) (*pb.CheckResponse, error)
func RunSingleLocalListObjectsTest ¶
func RunSingleLocalListObjectsTest( fgaServer *server.Server, listObjectsRequest *pb.ListObjectsRequest, ) (*pb.ListObjectsResponse, error)
func RunSingleLocalListUsersTest ¶ added in v0.4.0
func RunSingleLocalListUsersTest( fgaServer *server.Server, listUsersRequest *pb.ListUsersRequest, ) (*pb.ListUsersResponse, error)
Types ¶
type ModelTest ¶
type ModelTest struct { Name string `json:"name" yaml:"name"` Description string `json:"description" yaml:"description,omitempty"` Tuples []client.ClientContextualTupleKey `json:"tuples" yaml:"tuples,omitempty"` TupleFile string `json:"tuple_file" yaml:"tuple_file,omitempty"` //nolint:tagliatelle Check []ModelTestCheck `json:"check" yaml:"check"` ListObjects []ModelTestListObjects `json:"list_objects" yaml:"list_objects,omitempty"` //nolint:tagliatelle ListUsers []ModelTestListUsers `json:"list_users" yaml:"list_users,omitempty"` //nolint:tagliatelle }
type ModelTestCheck ¶
type ModelTestCheckSingleResult ¶
type ModelTestCheckSingleResult struct { Request client.ClientCheckRequest `json:"request"` Expected bool `json:"expected"` Got *bool `json:"got"` Error error `json:"error"` TestResult bool `json:"test_result"` }
func RunLocalCheckTest ¶
func RunLocalCheckTest( fgaServer *server.Server, checkTest ModelTestCheck, tuples []client.ClientContextualTupleKey, options ModelTestOptions, ) []ModelTestCheckSingleResult
func RunRemoteCheckTest ¶
func RunRemoteCheckTest( fgaClient *client.OpenFgaClient, checkTest ModelTestCheck, tuples []client.ClientContextualTupleKey, ) []ModelTestCheckSingleResult
func RunSingleRemoteCheckTest ¶
func RunSingleRemoteCheckTest( fgaClient *client.OpenFgaClient, checkRequest client.ClientCheckRequest, expectation bool, ) ModelTestCheckSingleResult
func (ModelTestCheckSingleResult) IsPassing ¶
func (result ModelTestCheckSingleResult) IsPassing() bool
type ModelTestListObjects ¶
type ModelTestListObjectsSingleResult ¶
type ModelTestListObjectsSingleResult struct { Request client.ClientListObjectsRequest `json:"request"` Expected []string `json:"expected"` Got []string `json:"got"` Error error `json:"error"` TestResult bool `json:"test_result"` }
func RunLocalListObjectsTest ¶
func RunLocalListObjectsTest( fgaServer *server.Server, listObjectsTest ModelTestListObjects, tuples []client.ClientContextualTupleKey, options ModelTestOptions, ) []ModelTestListObjectsSingleResult
func RunRemoteListObjectsTest ¶
func RunRemoteListObjectsTest( fgaClient *client.OpenFgaClient, listObjectsTest ModelTestListObjects, tuples []client.ClientContextualTupleKey, ) []ModelTestListObjectsSingleResult
func RunSingleRemoteListObjectsTest ¶
func RunSingleRemoteListObjectsTest( fgaClient *client.OpenFgaClient, listObjectsRequest client.ClientListObjectsRequest, expectation []string, ) ModelTestListObjectsSingleResult
func (ModelTestListObjectsSingleResult) IsPassing ¶
func (result ModelTestListObjectsSingleResult) IsPassing() bool
type ModelTestListUsers ¶ added in v0.4.0
type ModelTestListUsers struct { Object string `json:"object" yaml:"object"` UserFilter []openfga.UserTypeFilter `json:"user_filter" yaml:"user_filter"` //nolint:tagliatelle Context *map[string]interface{} `json:"context" yaml:"context,omitempty"` Assertions map[string]ModelTestListUsersAssertion `json:"assertions" yaml:"assertions"` }
type ModelTestListUsersAssertion ¶ added in v0.4.0
type ModelTestListUsersAssertion struct {
Users []string `json:"users" yaml:"users"`
}
type ModelTestListUsersSingleResult ¶ added in v0.4.0
type ModelTestListUsersSingleResult struct { Request client.ClientListUsersRequest `json:"request"` Expected ModelTestListUsersAssertion `json:"expected"` Got ModelTestListUsersAssertion `json:"got"` Error error `json:"error"` TestResult bool `json:"test_result"` }
func RunLocalListUsersTest ¶ added in v0.4.0
func RunLocalListUsersTest( fgaServer *server.Server, listUsersTest ModelTestListUsers, tuples []client.ClientContextualTupleKey, options ModelTestOptions, ) []ModelTestListUsersSingleResult
func RunRemoteListUsersTest ¶ added in v0.4.0
func RunRemoteListUsersTest( fgaClient *client.OpenFgaClient, listUsersTest ModelTestListUsers, tuples []client.ClientContextualTupleKey, ) []ModelTestListUsersSingleResult
func RunSingleRemoteListUsersTest ¶ added in v0.4.0
func RunSingleRemoteListUsersTest( fgaClient *client.OpenFgaClient, listUsersRequest client.ClientListUsersRequest, expectation ModelTestListUsersAssertion, ) ModelTestListUsersSingleResult
func (ModelTestListUsersSingleResult) IsPassing ¶ added in v0.4.0
func (result ModelTestListUsersSingleResult) IsPassing() bool
type ModelTestOptions ¶
type StoreData ¶
type StoreData struct { Name string `json:"name" yaml:"name"` Model string `json:"model" yaml:"model"` ModelFile string `json:"model_file" yaml:"model_file,omitempty"` //nolint:tagliatelle Tuples []client.ClientContextualTupleKey `json:"tuples" yaml:"tuples"` TupleFile string `json:"tuple_file" yaml:"tuple_file,omitempty"` //nolint:tagliatelle Tests []ModelTest `json:"tests" yaml:"tests"` }
func ReadFromFile ¶ added in v0.2.2
func ReadFromFile(fileName string, basePath string) (authorizationmodel.ModelFormat, *StoreData, error)
ReadFromFile is used to read and parse the Store file.
func (*StoreData) LoadModel ¶
func (storeData *StoreData) LoadModel(basePath string) (authorizationmodel.ModelFormat, error)
func (*StoreData) LoadTuples ¶ added in v0.2.2
type TestResult ¶
type TestResult struct { Name string `json:"name"` Description string `json:"description"` CheckResults []ModelTestCheckSingleResult `json:"check_results"` ListObjectsResults []ModelTestListObjectsSingleResult `json:"list_objects_results"` ListUsersResults []ModelTestListUsersSingleResult `json:"list_users_results"` }
func RunLocalTest ¶
func RunLocalTest( fgaServer *server.Server, test ModelTest, tuples []client.ClientContextualTupleKey, model *authorizationmodel.AuthzModel, ) (TestResult, error)
func RunRemoteTest ¶
func RunRemoteTest( fgaClient *client.OpenFgaClient, test ModelTest, testTuples []client.ClientContextualTupleKey, ) TestResult
func RunTest ¶
func RunTest( fgaClient *client.OpenFgaClient, fgaServer *server.Server, test ModelTest, globalTuples []client.ClientContextualTupleKey, model *authorizationmodel.AuthzModel, ) (TestResult, error)
func (TestResult) FriendlyFailuresDisplay ¶ added in v0.2.6
func (result TestResult) FriendlyFailuresDisplay() string
func (TestResult) IsPassing ¶ added in v0.1.1
func (result TestResult) IsPassing() bool
IsPassing - indicates whether a Test has succeeded completely or has any failing parts.
type TestResults ¶ added in v0.1.1
type TestResults struct {
Results []TestResult `json:"results"`
}
func RunTests ¶
func RunTests( fgaClient *client.OpenFgaClient, storeData *StoreData, format authorizationmodel.ModelFormat, ) (TestResults, error)
func (TestResults) FriendlyDisplay ¶ added in v0.1.1
func (test TestResults) FriendlyDisplay() string
func (TestResults) IsPassing ¶ added in v0.1.1
func (test TestResults) IsPassing() bool
IsPassing - indicates whether a Test Suite has succeeded completely or has any failing tests.
Click to show internal directories.
Click to hide internal directories.