-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(model): run tests against a built-in OpenFGA engine (#142)
- Loading branch information
Showing
18 changed files
with
1,065 additions
and
434 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,69 @@ | ||
--- | ||
- name: "folder-document-access" | ||
description: "" | ||
tuples: | ||
- user: user:anne | ||
relation: owner | ||
object: folder:product | ||
- user: folder:product | ||
relation: parent | ||
object: folder:product-2021 | ||
- user: user:beth | ||
relation: viewer | ||
object: folder:product-2021 | ||
check: | ||
- user: user:anne | ||
object: folder:product-2021 | ||
assertions: | ||
can_view: true | ||
can_write: true | ||
can_share: true | ||
- user: user:beth | ||
object: folder:product-2021 | ||
assertions: | ||
can_view: true | ||
can_write: false | ||
can_share: false | ||
list-objects: | ||
- user: user:anne | ||
type: folder | ||
assertions: | ||
can_view: | ||
- folder:product | ||
- folder:product-2021 | ||
can_write: | ||
- folder:product | ||
- folder:product-2021 | ||
can_share: | ||
- folder:product | ||
- folder:product-2021 | ||
- user: user:beth | ||
type: folder | ||
assertions: | ||
can_view: | ||
- folder:product-2021 | ||
can_write: [] | ||
can_share: [] | ||
name: FolderBox # store name | ||
model_file: ./model.fga # a global model that would apply to all tests | ||
# model can be used instead of model_file | ||
#model: | | ||
# model | ||
# schema 1.1 | ||
# type user | ||
# ... | ||
tuples: # global tuples that would apply to all tests | ||
- user: folder:5 | ||
relation: parent | ||
object: folder:product-2021 | ||
- user: folder:product-2021 | ||
relation: parent | ||
object: folder:product-2021Q1 | ||
tests: | ||
- name: "folder-document-access" | ||
description: "" | ||
tuples: # tuples in tests are appended to the global tuples and do not replace them | ||
- user: user:anne | ||
relation: owner | ||
object: folder:product | ||
- user: folder:product | ||
relation: parent | ||
object: folder:product-2021 | ||
- user: user:beth | ||
relation: viewer | ||
object: folder:product-2021 | ||
check: # Each check test is made of: a user, an object and the expected result for one or more relations | ||
- user: user:anne | ||
object: folder:product-2021 | ||
assertions: | ||
can_view: true | ||
can_write: true | ||
can_share: false | ||
- user: user:beth | ||
object: folder:product-2021 | ||
assertions: | ||
can_view: true | ||
can_write: false | ||
can_share: false | ||
- user: user:anne | ||
object: folder:product-2021Q1 | ||
assertions: | ||
can_view: true | ||
can_write: true | ||
can_share: false | ||
list_objects: # Each check test is made of: a user, an object type and the expected result for one or more relations | ||
- user: user:anne | ||
type: folder | ||
assertions: | ||
can_view: | ||
- folder:product | ||
- folder:product-2021 | ||
- folder:product-2021Q1 | ||
can_write: | ||
- folder:product | ||
- folder:product-2021 | ||
- folder:product-2021Q1 | ||
can_share: | ||
- folder:product | ||
- user: user:beth | ||
type: folder | ||
assertions: | ||
can_view: | ||
- folder:product-2021 | ||
- folder:product-2021Q1 | ||
can_write: [] | ||
can_share: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.