Skip to content
Snippets Groups Projects
Commit b6247d41 authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

TST: extended test simplified

parent 0e2332f6
No related branches found
No related tags found
1 merge request!53Release 0.1
...@@ -26,11 +26,13 @@ def rfp(*pathcomponents): ...@@ -26,11 +26,13 @@ def rfp(*pathcomponents):
return join(dirname(__file__), *pathcomponents) return join(dirname(__file__), *pathcomponents)
def dircheckstr(*pathcomponents): def dircheckstr(*pathcomponents, structure_element_type="Directory"):
""" """
Return the debug tree identifier for a given path. Return the debug tree identifier for a given path.
""" """
return "newcrawler.structure_elements.Directory: " + basename(join(*pathcomponents)) + ", " + rfp("test_directories", "examples_article", *pathcomponents) return ("newcrawler.structure_elements." + structure_element_type + ": " +
basename(join(*pathcomponents)) + ", " +
rfp("test_directories", "examples_article", *pathcomponents))
@pytest.fixture @pytest.fixture
...@@ -72,7 +74,9 @@ def crawler(): ...@@ -72,7 +74,9 @@ def crawler():
def test_file_structure_generation(crawler): def test_file_structure_generation(crawler):
subd = crawler.debug_tree[dircheckstr("DataAnalysis")] subd = crawler.debug_tree[dircheckstr("DataAnalysis")]
subc = crawler.debug_metadata["copied"][dircheckstr("DataAnalysis")] subc = crawler.debug_metadata["copied"][dircheckstr("DataAnalysis")]
sd = crawler.debug_tree['newcrawler.structure_elements.File: README.md, /home/salexan/Projekte/CaosDB/caosdb-newcrawler/unittests/test_directories/examples_article/SimulationData/2020_climate-model-predict/2020-02-01/README.md'] sd = crawler.debug_tree[dircheckstr("SimulationData",
"2020_climate-model-predict", "2020-02-01",
"README.md", structure_element_type="File")]
assert sd[1]["ReadmeFile"].role == "File" assert sd[1]["ReadmeFile"].role == "File"
assert len(sd[1]["ReadmeFile"].path) > 0 assert len(sd[1]["ReadmeFile"].path) > 0
assert len(sd[1]["ReadmeFile"].file) > 0 assert len(sd[1]["ReadmeFile"].file) > 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment