Skip to content
Snippets Groups Projects
Commit 4de47f4a authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

TST: Test crawler_main return code

parent ff0a883a
No related branches found
No related tags found
2 merge requests!217TST: Make NamedTemporaryFiles Windows-compatible,!208ENH: Allow crawler_main to operate on a list of paths
Pipeline #58706 passed
...@@ -78,12 +78,15 @@ def test_not_implemented_list_with_authorization(caplog, clear_database): ...@@ -78,12 +78,15 @@ def test_not_implemented_list_with_authorization(caplog, clear_database):
dirlist = [basepath / "dir1", basepath / "dir2"] dirlist = [basepath / "dir1", basepath / "dir2"]
# This is not implemented yet, so check log for correct error. # This is not implemented yet, so check log for correct error.
crawler_main( ret = crawler_main(
dirlist, dirlist,
cfood_file_name=basepath / "cfood.yml", cfood_file_name=basepath / "cfood.yml",
identifiables_definition_file=basepath / "identifiable.yml", identifiables_definition_file=basepath / "identifiable.yml",
securityMode=SecurityMode.RETRIEVE securityMode=SecurityMode.RETRIEVE
) )
# crawler_main hides the error, but has a non-zero return code and
# errors in the log:
assert ret != 0
err_tuples = [t for t in caplog.record_tuples if t[1] == logging.ERROR] err_tuples = [t for t in caplog.record_tuples if t[1] == logging.ERROR]
assert len(err_tuples) == 1 assert len(err_tuples) == 1
assert "currently implemented only for single paths, not for lists of paths" in err_tuples[0][2] assert "currently implemented only for single paths, not for lists of paths" in err_tuples[0][2]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment