You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/getting-started/testing.mdx
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ icon: 'vial'
4
4
title: 'Testing & Validation'
5
5
---
6
6
7
-
Testing is critical process when building and maintaining an authorization system. This page explains how to ensure the new authorization model and related authorization data works as expected in Permify.
7
+
Testing is a critical process when building and maintaining an authorization system. This page explains how to ensure the new authorization model and related authorization data works as expected in Permify.
8
8
9
9
Assuming that you're familiar with creating an authorization model and forming relation tuples in Permify. If not, we're strongly advising you to examine them before testing.
10
10
@@ -40,10 +40,10 @@ If you don't know how to create Github action workflow and add a action to it, y
40
40
41
41
## Schema Validation File
42
42
43
-
Below you can examine an example schema validation yaml file. It consists 3 parts;
44
-
- `schema` which is the authorization model you want to test,
45
-
- `relationships`sample data to test your model,
46
-
- `scenarios`to test access check queries within created scenarios.
43
+
Below, you can examine an example schema validation yaml file. It consists of 3 parts;
44
+
- `schema` which is the authorization model you want to test
45
+
- `relationships`which is the sample data to test your model
46
+
- `scenarios`which is the way to actually test access check queries within created scenarios
47
47
48
48
### Defining the Schema:
49
49
@@ -149,17 +149,17 @@ scenarios:
149
149
edit : ["58"]
150
150
```
151
151
152
-
Assuming that you're well-familiar with the `schema` and `relationships` sections of the above YAML file. If not, please see the previous sections to learn how to create an authorization model (schema) and generate data (relationships) according to it.
152
+
You should be familiar with the `schema` and `relationships` sections of the above YAML file. If not, please see the previous sections to learn how to [create an authorization model (the schema)](/getting-started/modeling) and [generate data (relationships)](/getting-started/sync-data) according to a schema.
153
153
154
-
We'll continue by examining how to create scenarios.
154
+
Next, you'll examine how to create scenarios.
155
155
156
156
## Creating Test Scenarios
157
157
158
158
You can create multiple access checks at once to test whether your authorization logic behaves as expected or not.
159
159
160
160
Besides simple access checks you can also test subject filtering queries and data (entity) filtering with it.
161
161
162
-
Let's deconstruct the `scenarios`,
162
+
Let's deconstruct the `scenarios` configuration.
163
163
164
164
### Scenarios
165
165
@@ -187,7 +187,7 @@ checks:
187
187
push : true
188
188
```
189
189
190
-
Semantics for above check is: whether `user:1` can push to `repository:3`, additional to stored tuples take account that user:1 is owner of repository:3 (`repository:3#owner@user:1`). Expected result for that check it **true** - `push : true`
190
+
Semantics for above check is: whether `user:1` can push to `repository:3`, in addition to stored tuples, take into account that user:1 is owner of repository:3 (`repository:3#owner@user:1`). Expected result for that check it **true** - `push : true`
191
191
192
192
### Depth Configuration
193
193
@@ -211,8 +211,8 @@ checks:
211
211
```
212
212
213
213
**When to use depth:**
214
-
- Use a lower depth (e.g., 3-5) for shallow permission hierarchies to improve performance
215
-
- Use a higher depth (e.g., 20-50) for deep nested relationships
214
+
- Use a lower depth (e.g., 3-5) for a shallow permission hierarchy to improve performance
215
+
- Use a higher depth (e.g., 20-50) for deeply nested relationships
216
216
- If you encounter "depth not enough" errors, increase the depth value for that specific check
217
217
218
218
<Note>
@@ -228,19 +228,19 @@ You can create `entity_filters` within `scenarios` to test your data filtering q
228
228
```yaml
229
229
entity_filters:
230
230
- entity_type: "repository" # entity that you want to filter
231
-
subject: "user:1" # subject that you want to perform data filtering
231
+
subject: "user:1" # subject for which you want to perform data filtering
context: null # additional data provided during an access check to be evaluated
234
234
assertions:
235
235
push : ["1", "3", "4", "5"] # IDs of the resources that we expected to return
236
236
edit : []
237
237
```
238
238
239
-
The major difference between `check` lies in the assertions part. Since we're performing data filtering with bulk data, instead of a true-false result, we enter the IDs of the resources that we expect to be returned
239
+
The major difference between `entity_filters` and `checks` lies in the assertions part. Since we're performing data filtering with bulk data, instead of a true-false result, we enter the IDs of the resources that we expect to be returned.
240
240
241
241
### Subject Filtering
242
242
243
-
You can create `subject_filters` within `scenarios` to test your subject filtering queries, a.k.a which users can perform action Y or have permission X on entity:Z?
243
+
You can create `subject_filters` within `scenarios` to test your subject filtering queries, such as which users can perform action Y or have permission X on entity:Z.
244
244
245
245
```yaml
246
246
- subject_reference: "user"
@@ -270,7 +270,7 @@ The output of the example provided above is as follows.
270
270
271
271
You can also test your new authorization model in your local (Permify clone) without using [permify-validate-action] at all.
272
272
273
-
For that open up a new file and add a schema yaml file inside. Then build your project with, run `make build` command and run `./permify validate {path of your schema validation file}`.
273
+
For that open up a new file and add a schema yaml file inside. Then build your project, run `make build` command and run `./permify validate {path of your schema validation file}`.
274
274
275
275
If we use the above example schema validation file, after running `./permify validate {path of your schema validation file}` it gives a result on the terminal as:
276
276
@@ -301,7 +301,7 @@ You can find more details about our suggested workflow to handle schema changes
301
301
302
302
## Need any help ?
303
303
304
-
Our team is happy to help you get started with Permify. If you'd like to learn more about using Permify in your app or have any questions about it, [schedule a consultation call with one of our account executives](hhttps://calendly.com/d/cj79-kyf-b4z).
304
+
Our team is happy to help you get started with Permify. If you'd like to learn more about using Permify in your app or have any questions about it, [schedule a consultation call with one of our account executives](https://calendly.com/d/cj79-kyf-b4z).
0 commit comments