1111def test_insert_map (token , client , connection , schemas_simple ):
1212 REST_response = client .post (
1313 "/insert" ,
14- json = {"A Id" : 1 , "B Id" : 32 , "B Number" : 1.23 , "C Id" : 400 , "c_int" : 99 },
14+ json = {
15+ "submissions" : [
16+ {"A Id" : 1 , "B Id" : 32 , "B Number" : 1.23 , "C Id" : 400 , "c_int" : 99 }
17+ ]
18+ },
1519 headers = dict (Authorization = f"Bearer { token } " ),
1620 )
1721 assert REST_response .status_code == 200 , REST_response .data
@@ -21,7 +25,11 @@ def test_insert_map(token, client, connection, schemas_simple):
2125def test_insert_no_map (token , client , connection , schemas_simple ):
2226 REST_response = client .post (
2327 "/insert3" ,
24- json = {"a_id" : 1 , "b_id" : 32 , "b_number" : 1.23 , "c_id" : 400 , "c_int" : 99 },
28+ json = {
29+ "submissions" : [
30+ {"a_id" : 1 , "b_id" : 32 , "b_number" : 1.23 , "c_id" : 400 , "c_int" : 99 }
31+ ]
32+ },
2533 headers = dict (Authorization = f"Bearer { token } " ),
2634 )
2735 assert REST_response .status_code == 200
@@ -31,7 +39,7 @@ def test_insert_no_map(token, client, connection, schemas_simple):
3139def test_insert_fail (token , client , connection , schemas_simple ):
3240 REST_response = client .post (
3341 "/insert3" ,
34- json = {"a_id" : 1 , "b_id" : 32 , "b_number" : 1.23 , "c_id" : 400 },
42+ json = {"submissions" : [{ " a_id" : 1 , "b_id" : 32 , "b_number" : 1.23 , "c_id" : 400 }] },
3543 headers = dict (Authorization = f"Bearer { token } " ),
3644 )
3745 assert REST_response .status_code == 500
@@ -111,8 +119,6 @@ def test_form_response_no_map_shared_FK_hierarchy(
111119 "type" : "table" ,
112120 "values" : [{"a_id" : 0 }, {"a_id" : 1 }],
113121 },
114- {"datatype" : "int" , "name" : "bs_id" , "type" : "attribute" },
115- {"datatype" : "float" , "name" : "bs_number" , "type" : "attribute" },
116122 {
117123 "name" : "test_group1_simple.TableB" ,
118124 "type" : "table" ,
@@ -122,9 +128,11 @@ def test_form_response_no_map_shared_FK_hierarchy(
122128 {"a_id" : 1 , "b_id" : 21 },
123129 ],
124130 },
131+ {"datatype" : "int" , "name" : "bs_id" , "type" : "attribute" },
132+ {"datatype" : "float" , "name" : "bs_number" , "type" : "attribute" },
125133 {"datatype" : "int" , "name" : "c_id" , "type" : "attribute" },
126134 {"datatype" : "int" , "name" : "c_int" , "type" : "attribute" },
127- ],
135+ ]
128136 }
129137
130138
@@ -157,21 +165,21 @@ def test_form_response_no_map_diff_FK(token, client, connection, schemas_simple)
157165 assert REST_response .status_code == 200 , f"Error: { REST_response .data } "
158166 assert REST_response .get_json () == {
159167 "fields" : [
168+ {
169+ "name" : "test_group3_simple.TableZ" ,
170+ "type" : "table" ,
171+ "values" : [{"z_id" : 0 }, {"z_id" : 1 }],
172+ },
160173 {
161174 "name" : "test_group4_simple.DiffTableZ" ,
162175 "type" : "table" ,
163176 "values" : [{"zs_id" : 0 }, {"zs_id" : 1 }],
164177 },
165178 {"datatype" : "int" , "name" : "y_id" , "type" : "attribute" },
166179 {"datatype" : "float" , "name" : "y_number" , "type" : "attribute" },
167- {
168- "name" : "test_group3_simple.TableZ" ,
169- "type" : "table" ,
170- "values" : [{"z_id" : 0 }, {"z_id" : 1 }],
171- },
172180 {"datatype" : "int" , "name" : "ys_id" , "type" : "attribute" },
173181 {"datatype" : "float" , "name" : "ys_number" , "type" : "attribute" },
174- ],
182+ ]
175183 }
176184
177185
@@ -210,35 +218,35 @@ def test_form_response_no_map_many_tables(token, client, connection, schemas_sim
210218 "type" : "table" ,
211219 "values" : [{"a_id" : 0 }, {"a_id" : 1 }],
212220 },
213- {"datatype" : "int" , "name" : "b_id" , "type" : "attribute" },
214- {"datatype" : "float" , "name" : "b_number" , "type" : "attribute" },
215- {"datatype" : "int" , "name" : "bs_id" , "type" : "attribute" },
216- {"datatype" : "float" , "name" : "bs_number" , "type" : "attribute" },
217- {"datatype" : "int" , "name" : "c_id" , "type" : "attribute" },
218- {"datatype" : "int" , "name" : "c_int" , "type" : "attribute" },
219221 {
220- "name" : "test_group4_simple.DiffTableZ " ,
222+ "name" : "test_group3_simple.TableX " ,
221223 "type" : "table" ,
222- "values" : [{"zs_id" : 0 }, {"zs_id" : 1 }],
224+ "values" : [
225+ {"x_id" : 0 , "x_int" : 10 , "x_name" : "Carlos" },
226+ {"x_id" : 1 , "x_int" : 20 , "x_name" : "Oscar" },
227+ ],
223228 },
224- {"datatype" : "int" , "name" : "y_id" , "type" : "attribute" },
225- {"datatype" : "float" , "name" : "y_number" , "type" : "attribute" },
226229 {
227230 "name" : "test_group3_simple.TableZ" ,
228231 "type" : "table" ,
229232 "values" : [{"z_id" : 0 }, {"z_id" : 1 }],
230233 },
231- {"datatype" : "int" , "name" : "ys_id" , "type" : "attribute" },
232- {"datatype" : "float" , "name" : "ys_number" , "type" : "attribute" },
233234 {
234- "name" : "test_group3_simple.TableX " ,
235+ "name" : "test_group4_simple.DiffTableZ " ,
235236 "type" : "table" ,
236- "values" : [
237- {"x_id" : 0 , "x_int" : 10 , "x_name" : "Carlos" },
238- {"x_id" : 1 , "x_int" : 20 , "x_name" : "Oscar" },
239- ],
237+ "values" : [{"zs_id" : 0 }, {"zs_id" : 1 }],
240238 },
239+ {"datatype" : "int" , "name" : "b_id" , "type" : "attribute" },
240+ {"datatype" : "float" , "name" : "b_number" , "type" : "attribute" },
241+ {"datatype" : "int" , "name" : "bs_id" , "type" : "attribute" },
242+ {"datatype" : "float" , "name" : "bs_number" , "type" : "attribute" },
243+ {"datatype" : "int" , "name" : "c_id" , "type" : "attribute" },
244+ {"datatype" : "int" , "name" : "c_int" , "type" : "attribute" },
245+ {"datatype" : "int" , "name" : "y_id" , "type" : "attribute" },
246+ {"datatype" : "float" , "name" : "y_number" , "type" : "attribute" },
247+ {"datatype" : "int" , "name" : "ys_id" , "type" : "attribute" },
248+ {"datatype" : "float" , "name" : "ys_number" , "type" : "attribute" },
241249 {"datatype" : "int" , "name" : "w_id" , "type" : "attribute" },
242250 {"datatype" : "int" , "name" : "w_int" , "type" : "attribute" },
243- ],
251+ ]
244252 }
0 commit comments