Skip to content
Snippets Groups Projects
Commit d48c0247 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

MAINT: update tests to new version

parent 842b18ac
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,8 @@ Person: ...@@ -21,6 +21,8 @@ Person:
responsible: responsible:
responsible: responsible:
datatype: REFERENCE datatype: REFERENCE
revisionOf:
datatype: REFERENCE
results: results:
datatype: REFERENCE datatype: REFERENCE
source: source:
......
...@@ -90,17 +90,23 @@ class CrawlerTest(unittest.TestCase): ...@@ -90,17 +90,23 @@ class CrawlerTest(unittest.TestCase):
self.assertIsNotNone(ana.get_property("responsible")) self.assertIsNotNone(ana.get_property("responsible"))
person = db.Record(id=ana.get_property("responsible").value[0]) person = db.Record(id=ana.get_property("responsible").value[0])
person.retrieve() person.retrieve()
print(person)
self.assertEqual("Only", person.get_property("firstname").value) self.assertEqual("Only", person.get_property("firstname").value)
# Should have a description # Should have a description
self.assertIsNotNone(ana.description) self.assertIsNotNone(ana.description)
# Should reference an experiment # Should reference an experiment
self.assertIsNotNone(ana.get_property("Experiment")) sources = [get_entity_with_id(el) for el in
exp = db.Record(id=ana.get_property("Experiment").value[0]) ana.get_property("source").value]
exp.retrieve() count = 0
self.assertEqual("2019-02-03", exp.get_property("date").value)
for s in sources:
if len(s.parents) > 0 and s.parents[0].name == "Experiment":
count += 1
self.assertEqual(count, 1)
self.assertEqual(len(sources), 2)
first_ana = ana
####################### #######################
# # second analysis # # # # second analysis # #
...@@ -118,10 +124,21 @@ class CrawlerTest(unittest.TestCase): ...@@ -118,10 +124,21 @@ class CrawlerTest(unittest.TestCase):
assert os.path.basename(datfile.path) == "analyse.py" assert os.path.basename(datfile.path) == "analyse.py"
# Should reference an experiment # Should reference an experiment
self.assertIsNotNone(ana.get_property("Experiment")) sources = [get_entity_with_id(el) for el in
exp = db.Record(id=ana.get_property("Experiment").value[0]) ana.get_property("source").value]
exp.retrieve() count = 0
self.assertEqual("2019-02-03", exp.get_property("date").value)
for s in sources:
if len(s.parents) > 0 and s.parents[0].name == "Experiment":
count += 1
self.assertEqual(count, 1)
self.assertEqual(len(sources), 1)
# Should reference the other analysis
self.assertIsNotNone(ana.get_property("revisionOf"))
a = db.Record(id=ana.get_property("revisionOf").value[0])
a.retrieve()
self.assertEqual(a.id, first_ana.id)
def test_simulation(self): def test_simulation(self):
###################### ######################
...@@ -162,8 +179,15 @@ class CrawlerTest(unittest.TestCase): ...@@ -162,8 +179,15 @@ class CrawlerTest(unittest.TestCase):
"FIND Simulation with date=2019-02-03 and identifier='something'", "FIND Simulation with date=2019-02-03 and identifier='something'",
unique=True) unique=True)
exp = get_entity_with_id(sim.get_property("Experiment").value[0]) sources = [get_entity_with_id(el) for el in
self.assertEqual(exp.parents[0].name, "Experiment") sim.get_property("source").value]
count = 0
for s in sources:
if len(s.parents) > 0 and s.parents[0].name == "Experiment":
count += 1
self.assertEqual(count, 1)
self.assertEqual(len(sources), 3)
# Should be the same project # Should be the same project
assert project_id == sim.get_property("Project").value assert project_id == sim.get_property("Project").value
...@@ -205,7 +229,7 @@ class CrawlerTest(unittest.TestCase): ...@@ -205,7 +229,7 @@ class CrawlerTest(unittest.TestCase):
assert os.path.basename(datfile.path) == "poster.pdf" assert os.path.basename(datfile.path) == "poster.pdf"
# There should be a file as data attached # There should be a file as data attached
datfile_id = pub.get_property("source").value[0] datfile_id = pub.get_property("source").value[1]
datfile = get_entity_with_id(datfile_id) datfile = get_entity_with_id(datfile_id)
assert os.path.basename(datfile.path) == "results.pdf" assert os.path.basename(datfile.path) == "results.pdf"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment