@@ -251,7 +251,6 @@ class UserAnnotatedSequenceNamesSchema(UserAttributesBaseSchema):
251
251
assert detail ["msg" ].endswith (format_error (flag_name )), detail ["msg" ]
252
252
253
253
254
- @pytest .mark .xfail (reason = "tasks ids passthrough not checked yet" )
255
254
@pytest .mark .usefixtures ("refresh_db" )
256
255
class TestTaskValidators :
257
256
async def test_base_model_validator_pre_true_get_one (
@@ -262,6 +261,7 @@ async def test_base_model_validator_pre_true_get_one(
262
261
task_with_none_ids : Task ,
263
262
):
264
263
assert task_with_none_ids .task_ids is None
264
+ assert task_with_none_ids .another_task_ids is None
265
265
url = app .url_path_for (f"get_{ resource_type } _detail" , obj_id = task_with_none_ids .id )
266
266
res = await client .get (url )
267
267
assert res .status_code == status .HTTP_200_OK , res .text
@@ -271,15 +271,17 @@ async def test_base_model_validator_pre_true_get_one(
271
271
"data" : {
272
272
"id" : ViewBase .get_db_item_id (task_with_none_ids ),
273
273
"type" : resource_type ,
274
+ # dont' pass fields at all
274
275
},
275
276
"jsonapi" : {"version" : "1.0" },
276
277
"meta" : None ,
277
278
}
278
279
assert attributes == {
279
280
# not `None`! schema validator returns empty list `[]`
280
281
"task_ids" : [],
282
+ "another_task_ids" : [],
281
283
}
282
- assert attributes == TaskBaseSchema .model_validate (task_with_none_ids )
284
+ assert attributes == TaskBaseSchema .model_validate (task_with_none_ids ). model_dump ()
283
285
284
286
async def test_base_model_model_validator_get_list (
285
287
self ,
@@ -289,6 +291,7 @@ async def test_base_model_model_validator_get_list(
289
291
task_with_none_ids : Task ,
290
292
):
291
293
assert task_with_none_ids .task_ids is None
294
+ assert task_with_none_ids .another_task_ids is None
292
295
url = app .url_path_for (f"get_{ resource_type } _list" )
293
296
res = await client .get (url )
294
297
assert res .status_code == status .HTTP_200_OK , res .text
@@ -300,6 +303,7 @@ async def test_base_model_model_validator_get_list(
300
303
"attributes" : {
301
304
# not `None`! schema validator returns empty list `[]`
302
305
"task_ids" : [],
306
+ "another_task_ids" : [],
303
307
},
304
308
},
305
309
]
@@ -315,6 +319,7 @@ async def test_base_model_model_validator_create(
315
319
task_data = {
316
320
# should be converted to [] by schema on create
317
321
"task_ids" : None ,
322
+ "another_task_ids" : None ,
318
323
}
319
324
data_create = {
320
325
"data" : {
@@ -332,12 +337,14 @@ async def test_base_model_model_validator_create(
332
337
# we sent request with `None`, but value in db is `[]`
333
338
# because validator converted data before object creation
334
339
assert task .task_ids == []
340
+ assert task .another_task_ids == []
335
341
assert response_data == {
336
342
"data" : {
337
343
"type" : resource_type ,
338
344
"attributes" : {
339
345
# should be empty list
340
346
"task_ids" : [],
347
+ "another_task_ids" : [],
341
348
},
342
349
},
343
350
"jsonapi" : {"version" : "1.0" },
0 commit comments