@@ -36,6 +36,21 @@ func TestImportStore(t *testing.T) {
36
36
Expectation : true ,
37
37
},
38
38
}
39
+
40
+ multiObjectAssertions := []client.ClientAssertion {
41
+ {
42
+ User : "user:peter" ,
43
+ Relation : "reader" ,
44
+ Object : "document:doc1" ,
45
+ Expectation : true ,
46
+ },
47
+ {
48
+ User : "user:peter" ,
49
+ Relation : "reader" ,
50
+ Object : "document:doc2" ,
51
+ Expectation : true ,
52
+ },
53
+ }
39
54
modelID , storeID := "model-1" , "store-1"
40
55
expectedOptions := client.ClientWriteAssertionsOptions {AuthorizationModelId : & modelID , StoreId : & storeID }
41
56
@@ -75,6 +90,30 @@ func TestImportStore(t *testing.T) {
75
90
mockWriteAssertions : true ,
76
91
mockWriteModel : true ,
77
92
mockCreateStore : true ,
93
+ testStore : storetest.StoreData {
94
+ Model : `type user
95
+ type document
96
+ relations
97
+ define reader: [user]` ,
98
+ Tests : []storetest.ModelTest {
99
+ {
100
+ Name : "Test" ,
101
+ Check : []storetest.ModelTestCheck {
102
+ {
103
+ Users : []string {"user:anne" , "user:peter" },
104
+ Object : "document:doc1" ,
105
+ Assertions : map [string ]bool {"reader" : true },
106
+ },
107
+ },
108
+ },
109
+ },
110
+ },
111
+ },
112
+ {
113
+ name : "import store with multi object assertions" ,
114
+ mockWriteAssertions : true ,
115
+ mockWriteModel : true ,
116
+ mockCreateStore : true ,
78
117
testStore : storetest.StoreData {
79
118
Model : `type user
80
119
type document
@@ -85,8 +124,8 @@ func TestImportStore(t *testing.T) {
85
124
Name : "Test" ,
86
125
Check : []storetest.ModelTestCheck {
87
126
{
88
- Users : [] string { "user:anne" , "user:peter" } ,
89
- Object : "document:doc1" ,
127
+ User : "user:peter" ,
128
+ Objects : [] string { "document:doc1" , "document:doc2" } ,
90
129
Assertions : map [string ]bool {"reader" : true },
91
130
},
92
131
},
@@ -147,8 +186,12 @@ func TestImportStore(t *testing.T) {
147
186
148
187
if test .mockWriteAssertions {
149
188
expected := expectedAssertions
150
- if test .name == "import store with multi user assertions" {
189
+
190
+ switch test .name {
191
+ case "import store with multi user assertions" :
151
192
expected = multiUserAssertions
193
+ case "import store with multi object assertions" :
194
+ expected = multiObjectAssertions
152
195
}
153
196
154
197
setupWriteAssertionsMock (mockCtrl , mockFgaClient , expected , expectedOptions )
0 commit comments