def test_directory_dataset_include_all(admin_client, file_tree_with_datasets):
res = admin_client.get(
"/v3/directories",
{
"dataset": file_tree_with_datasets["dataset_a"].id,
"pagination": False,
"include_nulls": True,
"path": "/dir",
"include_all": True, # include also non-dataset files
**file_tree_with_datasets["params"],
},
)
assert res.status_code == 200
# Response should include also non_dataset files and have the dataset_metadata field
dm = {"dataset_metadata": None}
assert_nested_subdict(
{
"directory": {
"name": "dir",
"file_count": 15,
"size": 15 * 1024,
**dm,
},
"directories": [
{"name": "sub1", "file_count": 3, "size": 3 * 1024, **dm},
{"name": "sub2", "file_count": 1, "size": 1024, **dm},
{"name": "sub3", "file_count": 1, "size": 1024, **dm},
{"name": "sub4", "file_count": 1, "size": 1024, **dm},
{"name": "sub5", "file_count": 2, "size": 2 * 1024, **dm},
{"name": "sub6", "file_count": 1, "size": 1024, **dm},
],
"files": [
{"filename": "a.txt", **dm},
{"filename": "b.txt", **dm},
{"filename": "c.txt", **dm},
{"filename": "d.txt", **dm},
{"filename": "e.txt", **dm},
{"filename": "f.txt", **dm},
],
},
res.data,
check_list_length=True,
)