Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/tests/test_pytest_plugin.py
Show All 25 Lines | assert set(sample_data.keys()) == set( | ||||
"origin_visit", | "origin_visit", | ||||
"fetcher", | "fetcher", | ||||
"authority", | "authority", | ||||
"origin_metadata", | "origin_metadata", | ||||
"content_metadata", | "content_metadata", | ||||
] | ] | ||||
) | ) | ||||
for object_type, objs in sample_data.items(): | for object_type, objs in sample_data.items(): | ||||
for obj in objs: | if object_type in [ | ||||
assert isinstance(obj, dict) | "fetcher", | ||||
"authority", | |||||
"origin_metadata", | |||||
"content_metadata", | |||||
]: | |||||
type_ = BaseModel | |||||
else: | |||||
type_ = dict | |||||
if sample_data_model.get(object_type): | for obj in objs: | ||||
# metadata keys are missing because conversion is not possible yet | assert isinstance(obj, type_) | ||||
assert len(objs) == len(sample_data_model[object_type]) | |||||
def test_sample_data_model(sample_data, sample_data_model): | def test_sample_data_model(sample_data, sample_data_model): | ||||
assert set(sample_data_model.keys()) == set( | assert set(sample_data_model.keys()) == set( | ||||
[ | [ | ||||
"content", | "content", | ||||
"content_no_data", | "content_no_data", | ||||
"skipped_content", | "skipped_content", | ||||
Show All 29 Lines |