Select Git revision
ext_cosmetics_test_data.py
-
Henrik tom Wörden authoredHenrik tom Wörden authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
test_im_und_export.py 1.51 KiB
#!/usr/bin/env python3
import os
import unittest
from tempfile import TemporaryDirectory
import caosdb as db
from caosadvancedtools.export_related import export
from caosadvancedtools.import_from_xml import import_xml
if __name__ == "__main__":
print("Conducting im- and export tests")
rec = db.execute_query("FIND 2019-02-03_really_cool_finding", unique=True)
directory = TemporaryDirectory()
export(rec.id, directory=directory.name)
# delete everything
rec = db.execute_query("FIND record which was inserted by me")
prop = db.execute_query("FIND property which was inserted by me")
rt = db.execute_query("FIND recordtype which was inserted by me")
fi = db.execute_query("FIND file which was inserted by me")
c = db.Container()
c.extend(rec+prop+rt+fi)
c.delete()
assert 0 == len(db.execute_query("FIND File which is stored at "
"**/poster.pdf"))
import_xml(os.path.join(directory.name, "caosdb_data.xml"), interactive=False)
# The following tests the existence of some required entities.
# However, this is not a full list.
db.execute_query("FIND 2019-02-03_really_cool_finding", unique=True)
db.execute_query("FIND RecordType Poster", unique=True)
db.execute_query("FIND RecordType Analysis", unique=True)
db.execute_query("FIND RecordType Person", unique=True)
db.execute_query("FIND Record Person with firstname=Only", unique=True)
db.execute_query("FIND File which is stored at **/poster.pdf", unique=True)