@@ -13,7 +13,7 @@ def test_insert_map(token, client, connection, schemas_simple):
1313 "/insert" ,
1414 json = {
1515 "submissions" : [
16- {"A Id" : 1 , "B Id" : 32 , "B Number" : 1.23 , "C Id" : 400 , "c_int " : 99 }
16+ {"A Id" : 1 , "B Id" : 32 , "B Number" : 1.23 , "C Id" : 400 , "c_name " : "John" }
1717 ]
1818 },
1919 headers = dict (Authorization = f"Bearer { token } " ),
@@ -27,7 +27,13 @@ def test_insert_no_map(token, client, connection, schemas_simple):
2727 "/insert3?group=test_group1" ,
2828 json = {
2929 "submissions" : [
30- {"a_id" : 1 , "b_id" : 32 , "b_number" : 1.23 , "c_id" : 400 , "c_int" : 99 }
30+ {
31+ "a_id" : 1 ,
32+ "b_id" : 32 ,
33+ "b_number" : 1.23 ,
34+ "c_id" : 400 ,
35+ "c_name" : "Smith" ,
36+ }
3137 ]
3238 },
3339 headers = dict (Authorization = f"Bearer { token } " ),
@@ -39,7 +45,7 @@ def test_insert_no_map(token, client, connection, schemas_simple):
3945def test_insert_fail (token , client , connection , schemas_simple ):
4046 REST_response = client .post (
4147 "/insert3?group=test_group1" ,
42- json = {"submissions" : [{"a_id" : 1 , "b_id" : 32 , "b_number" : 1.23 , "c_id" : 400 }]},
48+ json = {"submissions" : [{"a_id" : 1 , "b_id" : 32 , "b_number" : 1.23 }]},
4349 headers = dict (Authorization = f"Bearer { token } " ),
4450 )
4551 assert REST_response .status_code == 500
@@ -61,11 +67,21 @@ def test_form_response(token, client, connection, schemas_simple):
6167 assert REST_response .status_code == 200 , f"Error: { REST_response .data } "
6268 assert REST_response .get_json () == {
6369 "fields" : [
64- {"datatype" : "int" , "name" : "B Id" , "type" : "attribute" },
65- {"datatype" : "float" , "name" : "B Number" , "type" : "attribute" },
70+ {"datatype" : "int" , "name" : "B Id" , "type" : "attribute" , "default" : None },
71+ {
72+ "datatype" : "float" ,
73+ "name" : "B Number" ,
74+ "type" : "attribute" ,
75+ "default" : None ,
76+ },
6677 {"name" : "Table A" , "type" : "table" , "values" : [{"A Id" : 0 }, {"A Id" : 1 }]},
67- {"datatype" : "int" , "name" : "C Id" , "type" : "attribute" },
68- {"datatype" : "int" , "name" : "c_int" , "type" : "attribute" },
78+ {"datatype" : "int" , "name" : "C Id" , "type" : "attribute" , "default" : None },
79+ {
80+ "datatype" : "varchar(30)" ,
81+ "name" : "c_name" ,
82+ "type" : "attribute" ,
83+ "default" : '"John Smith"' ,
84+ },
6985 ],
7086 }
7187
@@ -78,11 +94,21 @@ def test_form_response_no_table_map(token, client, connection, schemas_simple):
7894 assert REST_response .status_code == 200 , f"Error: { REST_response .data } "
7995 assert REST_response .get_json () == {
8096 "fields" : [
81- {"datatype" : "int" , "name" : "B Id" , "type" : "attribute" },
82- {"datatype" : "float" , "name" : "B Number" , "type" : "attribute" },
97+ {"datatype" : "int" , "name" : "B Id" , "type" : "attribute" , "default" : None },
98+ {
99+ "datatype" : "float" ,
100+ "name" : "B Number" ,
101+ "type" : "attribute" ,
102+ "default" : None ,
103+ },
83104 {"name" : "Table A" , "type" : "table" , "values" : [{"a_id" : 0 }, {"a_id" : 1 }]},
84- {"datatype" : "int" , "name" : "C Id" , "type" : "attribute" },
85- {"datatype" : "int" , "name" : "c_int" , "type" : "attribute" },
105+ {"datatype" : "int" , "name" : "C Id" , "type" : "attribute" , "default" : None },
106+ {
107+ "datatype" : "varchar(30)" ,
108+ "name" : "c_name" ,
109+ "type" : "attribute" ,
110+ "default" : '"John Smith"' ,
111+ },
86112 ],
87113 }
88114
@@ -100,10 +126,20 @@ def test_form_response_no_map(token, client, connection, schemas_simple):
100126 "type" : "table" ,
101127 "values" : [{"a_id" : 0 }, {"a_id" : 1 }],
102128 },
103- {"datatype" : "int" , "name" : "b_id" , "type" : "attribute" },
104- {"datatype" : "float" , "name" : "b_number" , "type" : "attribute" },
105- {"datatype" : "int" , "name" : "c_id" , "type" : "attribute" },
106- {"datatype" : "int" , "name" : "c_int" , "type" : "attribute" },
129+ {"datatype" : "int" , "name" : "b_id" , "type" : "attribute" , "default" : None },
130+ {
131+ "datatype" : "float" ,
132+ "name" : "b_number" ,
133+ "type" : "attribute" ,
134+ "default" : None ,
135+ },
136+ {"datatype" : "int" , "name" : "c_id" , "type" : "attribute" , "default" : None },
137+ {
138+ "datatype" : "varchar(30)" ,
139+ "name" : "c_name" ,
140+ "type" : "attribute" ,
141+ "default" : '"John Smith"' ,
142+ },
107143 ],
108144 }
109145
@@ -132,10 +168,20 @@ def test_form_response_no_map_shared_FK_hierarchy(
132168 {"a_id" : 1 , "b_id" : 21 },
133169 ],
134170 },
135- {"datatype" : "int" , "name" : "bs_id" , "type" : "attribute" },
136- {"datatype" : "float" , "name" : "bs_number" , "type" : "attribute" },
137- {"datatype" : "int" , "name" : "c_id" , "type" : "attribute" },
138- {"datatype" : "int" , "name" : "c_int" , "type" : "attribute" },
171+ {"datatype" : "int" , "name" : "bs_id" , "type" : "attribute" , "default" : None },
172+ {
173+ "datatype" : "float" ,
174+ "name" : "bs_number" ,
175+ "type" : "attribute" ,
176+ "default" : None ,
177+ },
178+ {"datatype" : "int" , "name" : "c_id" , "type" : "attribute" , "default" : None },
179+ {
180+ "datatype" : "varchar(30)" ,
181+ "name" : "c_name" ,
182+ "type" : "attribute" ,
183+ "default" : '"John Smith"' ,
184+ },
139185 ]
140186 }
141187
@@ -153,10 +199,20 @@ def test_form_response_no_map_shared_FK(token, client, connection, schemas_simpl
153199 "type" : "table" ,
154200 "values" : [{"a_id" : 0 }, {"a_id" : 1 }],
155201 },
156- {"datatype" : "int" , "name" : "b_id" , "type" : "attribute" },
157- {"datatype" : "float" , "name" : "b_number" , "type" : "attribute" },
158- {"datatype" : "int" , "name" : "bs_id" , "type" : "attribute" },
159- {"datatype" : "float" , "name" : "bs_number" , "type" : "attribute" },
202+ {"datatype" : "int" , "name" : "b_id" , "type" : "attribute" , "default" : None },
203+ {
204+ "datatype" : "float" ,
205+ "name" : "b_number" ,
206+ "type" : "attribute" ,
207+ "default" : None ,
208+ },
209+ {"datatype" : "int" , "name" : "bs_id" , "type" : "attribute" , "default" : None },
210+ {
211+ "datatype" : "float" ,
212+ "name" : "bs_number" ,
213+ "type" : "attribute" ,
214+ "default" : None ,
215+ },
160216 ],
161217 }
162218
@@ -179,10 +235,20 @@ def test_form_response_no_map_diff_FK(token, client, connection, schemas_simple)
179235 "type" : "table" ,
180236 "values" : [{"zs_id" : 0 }, {"zs_id" : 1 }],
181237 },
182- {"datatype" : "int" , "name" : "y_id" , "type" : "attribute" },
183- {"datatype" : "float" , "name" : "y_number" , "type" : "attribute" },
184- {"datatype" : "int" , "name" : "ys_id" , "type" : "attribute" },
185- {"datatype" : "float" , "name" : "ys_number" , "type" : "attribute" },
238+ {"datatype" : "int" , "name" : "y_id" , "type" : "attribute" , "default" : None },
239+ {
240+ "datatype" : "float" ,
241+ "name" : "y_number" ,
242+ "type" : "attribute" ,
243+ "default" : None ,
244+ },
245+ {"datatype" : "int" , "name" : "ys_id" , "type" : "attribute" , "default" : None },
246+ {
247+ "datatype" : "float" ,
248+ "name" : "ys_number" ,
249+ "type" : "attribute" ,
250+ "default" : None ,
251+ },
186252 ]
187253 }
188254
@@ -203,8 +269,8 @@ def test_form_response_no_map_multi_FPK(token, client, connection, schemas_simpl
203269 {"x_id" : 1 , "x_int" : 20 , "x_name" : "Oscar" },
204270 ],
205271 },
206- {"datatype" : "int" , "name" : "w_id" , "type" : "attribute" },
207- {"datatype" : "int" , "name" : "w_int" , "type" : "attribute" },
272+ {"datatype" : "int" , "name" : "w_id" , "type" : "attribute" , "default" : None },
273+ {"datatype" : "int" , "name" : "w_int" , "type" : "attribute" , "default" : "123" },
208274 ],
209275 }
210276
@@ -240,17 +306,42 @@ def test_form_response_no_map_many_tables(token, client, connection, schemas_sim
240306 "type" : "table" ,
241307 "values" : [{"zs_id" : 0 }, {"zs_id" : 1 }],
242308 },
243- {"datatype" : "int" , "name" : "b_id" , "type" : "attribute" },
244- {"datatype" : "float" , "name" : "b_number" , "type" : "attribute" },
245- {"datatype" : "int" , "name" : "bs_id" , "type" : "attribute" },
246- {"datatype" : "float" , "name" : "bs_number" , "type" : "attribute" },
247- {"datatype" : "int" , "name" : "c_id" , "type" : "attribute" },
248- {"datatype" : "int" , "name" : "c_int" , "type" : "attribute" },
249- {"datatype" : "int" , "name" : "y_id" , "type" : "attribute" },
250- {"datatype" : "float" , "name" : "y_number" , "type" : "attribute" },
251- {"datatype" : "int" , "name" : "ys_id" , "type" : "attribute" },
252- {"datatype" : "float" , "name" : "ys_number" , "type" : "attribute" },
253- {"datatype" : "int" , "name" : "w_id" , "type" : "attribute" },
254- {"datatype" : "int" , "name" : "w_int" , "type" : "attribute" },
309+ {"datatype" : "int" , "name" : "b_id" , "type" : "attribute" , "default" : None },
310+ {
311+ "datatype" : "float" ,
312+ "name" : "b_number" ,
313+ "type" : "attribute" ,
314+ "default" : None ,
315+ },
316+ {"datatype" : "int" , "name" : "bs_id" , "type" : "attribute" , "default" : None },
317+ {
318+ "datatype" : "float" ,
319+ "name" : "bs_number" ,
320+ "type" : "attribute" ,
321+ "default" : None ,
322+ },
323+ {"datatype" : "int" , "name" : "c_id" , "type" : "attribute" , "default" : None },
324+ {
325+ "datatype" : "varchar(30)" ,
326+ "name" : "c_name" ,
327+ "type" : "attribute" ,
328+ "default" : '"John Smith"' ,
329+ },
330+ {"datatype" : "int" , "name" : "y_id" , "type" : "attribute" , "default" : None },
331+ {
332+ "datatype" : "float" ,
333+ "name" : "y_number" ,
334+ "type" : "attribute" ,
335+ "default" : None ,
336+ },
337+ {"datatype" : "int" , "name" : "ys_id" , "type" : "attribute" , "default" : None },
338+ {
339+ "datatype" : "float" ,
340+ "name" : "ys_number" ,
341+ "type" : "attribute" ,
342+ "default" : None ,
343+ },
344+ {"datatype" : "int" , "name" : "w_id" , "type" : "attribute" , "default" : None },
345+ {"datatype" : "int" , "name" : "w_int" , "type" : "attribute" , "default" : "123" },
255346 ]
256347 }
0 commit comments