@@ -68,6 +68,17 @@ func TestAccAuthorizationModelDocumentDataSource(t *testing.T) {
68
68
const expectedAuthorizationModelDocumentDataSourceResult = `{"conditions":{"larger_than":{"expression":"a \u003e b","name":"larger_than","parameters":{"a":{"generic_types":[],"type_name":"TYPE_NAME_INT"},"b":{"generic_types":[],"type_name":"TYPE_NAME_INT"}}}},"schema_version":"1.1","type_definitions":[{"relations":{},"type":"user"},{"metadata":{"module":"","relations":{"viewer":{"directly_related_user_types":[{"condition":"","type":"user"}],"module":""}}},"relations":{"viewer":{"this":{}}},"type":"document"}]}`
69
69
const expectedModularAuthorizationModelDocumentDataSourceResult = `{"conditions":{"larger_than":{"expression":"a \u003e b","metadata":{"module":"conditions","source_info":{"file":"conditions/larger_than.fga"}},"name":"larger_than","parameters":{"a":{"generic_types":[],"type_name":"TYPE_NAME_INT"},"b":{"generic_types":[],"type_name":"TYPE_NAME_INT"}}}},"schema_version":"1.2","type_definitions":[{"metadata":{"module":"user","relations":{},"source_info":{"file":"user.fga"}},"relations":{},"type":"user"},{"metadata":{"module":"document","relations":{"viewer":{"directly_related_user_types":[{"condition":"","type":"user"}],"module":""}},"source_info":{"file":"document.fga"}},"relations":{"viewer":{"this":{}}},"type":"document"}]}`
70
70
71
+ const authorizationModelResource = `
72
+ resource "openfga_store" "test" {
73
+ name = "test"
74
+ }
75
+
76
+ resource "openfga_authorization_model" "test" {
77
+ store_id = openfga_store.test.id
78
+
79
+ model_json = data.openfga_authorization_model_document.test.result
80
+ }`
81
+
71
82
func testAccAuthorizationModelDocumentDataSourceConfigDsl () string {
72
83
return fmt .Sprintf (`
73
84
%[1]s
@@ -88,7 +99,9 @@ condition larger_than(a: int, b: int) {
88
99
}
89
100
EOT
90
101
}
91
- ` , acceptance .ProviderConfig )
102
+
103
+ %[2]s
104
+ ` , acceptance .ProviderConfig , authorizationModelResource )
92
105
}
93
106
94
107
func testAccAuthorizationModelDocumentDataSourceConfigModFile () string {
@@ -97,7 +110,10 @@ func testAccAuthorizationModelDocumentDataSourceConfigModFile() string {
97
110
98
111
data "openfga_authorization_model_document" "test" {
99
112
mod_file_path = "${path.root}/../acceptance/modularmodel/fga.mod"
100
- }` , acceptance .ProviderConfig )
113
+ }
114
+
115
+ %[2]s
116
+ ` , acceptance .ProviderConfig , authorizationModelResource )
101
117
}
102
118
103
119
func testAccAuthorizationModelDocumentDataSourceConfigJson () string {
@@ -126,7 +142,9 @@ data "openfga_authorization_model_document" "test" {
126
142
}
127
143
EOT
128
144
}
129
- ` , acceptance .ProviderConfig )
145
+
146
+ %[2]s
147
+ ` , acceptance .ProviderConfig , authorizationModelResource )
130
148
}
131
149
132
150
func testAccAuthorizationModelDocumentDataSourceConfigModel () string {
@@ -174,5 +192,7 @@ data "openfga_authorization_model_document" "test" {
174
192
}
175
193
}
176
194
}
177
- ` , acceptance .ProviderConfig )
195
+
196
+ %[2]s
197
+ ` , acceptance .ProviderConfig , authorizationModelResource )
178
198
}
0 commit comments