Skip to content

Commit fabe26f

Browse files
committed
add tests for validate cmd
1 parent b313314 commit fabe26f

12 files changed

+169
-1
lines changed

internal/cmd/import_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestImportCmdHappyPath(t *testing.T) {
2424
zedtesting.IntFlag{FlagName: "batch-size", FlagValue: 100},
2525
zedtesting.IntFlag{FlagName: "workers", FlagValue: 1},
2626
)
27-
f := filepath.Join("test", "happy-path-validation-file.yaml")
27+
f := filepath.Join("import-test", "happy-path-validation-file.yaml")
2828

2929
// Set up client
3030
ctx, cancel := context.WithCancel(context.Background())
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
schemaFile: "./external-schema.zed"
3+
relationships: >-
4+
resource:1#user@user:1
5+
assertions:
6+
assertTrue:
7+
- "resource:1#user@user:1"
8+
assertFalse:
9+
- "resource:1#user@user:2"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
definition user {}
2+
3+
definition resource {
4+
relation user: user
5+
permission view = user
6+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
schema: |-
3+
definition user {}
4+
5+
definition document {
6+
relation view: user
7+
permission viewer = view
8+
}
9+
assertions:
10+
assertTrue:
11+
- "document:1#viewer@user:maria"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
something something {}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
relationships: >-
3+
resource:1#user@user:1
4+
assertions:
5+
assertTrue:
6+
- "resource:1#user@user:1"
7+
assertFalse:
8+
- "resource:1#user@user:2"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// "and" is a reserved keyword in composable schemas
2+
definition and {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
definition user {}
2+
3+
definition resource {
4+
relation user: user
5+
permission view = user
6+
}

0 commit comments

Comments
 (0)