Skip to content
Snippets Groups Projects
Select Git revision
  • 81e7d18efe79c67c8ee6fb8b927275fba5ae6d81
  • main default protected
  • dev protected
  • f-render-html-properties
  • f-vishesh0932-ext-cosmetics
  • f-table-references
  • f-update-legacy-adapter
  • f-refactor-refs
  • f-fix-caosadvancedtools-refs
  • f-linkahead-rename
  • f-citation-cff
  • f-map-resolve-reference
  • dev-bmpg
  • f-form-select
  • f-doc-extention
  • f-geo-position-records
  • f-data-analysis
  • f-area-folder-drop
  • f-fix-get-parents
  • f-fix-110
  • f-entity-state
  • v0.16.0
  • v0.15.2
  • v0.15.1
  • v0.15.0
  • v0.14.0
  • v0.13.3
  • v0.13.2
  • v0.13.1
  • v0.13.0
  • v0.12.0
  • v0.11.1
  • v0.11.0
  • v0.10.1
  • v0.10.0
  • v0.9.0
  • v0.8.0
  • v0.7.0
  • v0.6.0
  • v0.5.0
  • v0.4.2
41 results

ext_cosmetics_test_data.py

Blame
  • 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)