From a3eb23a638efb8a13d88d6d413eefbeca74df454 Mon Sep 17 00:00:00 2001 From: florian <f.spreckelsen@inidscale.com> Date: Wed, 18 May 2022 09:07:16 +0200 Subject: [PATCH] MAINT: Clean-up of real-world example --- integrationtests/realworld_example/crawl.sh | 4 -- .../load_and_insert_json_models.py | 47 ------------------- .../realworld_example/test_dataset_crawler.py | 11 ++++- 3 files changed, 10 insertions(+), 52 deletions(-) delete mode 100755 integrationtests/realworld_example/crawl.sh delete mode 100644 integrationtests/realworld_example/load_and_insert_json_models.py diff --git a/integrationtests/realworld_example/crawl.sh b/integrationtests/realworld_example/crawl.sh deleted file mode 100755 index 55a2a331..00000000 --- a/integrationtests/realworld_example/crawl.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -python -m caosadvancedtools.loadFiles /opt/caosdb/mnt/extroot/data -python load_and_insert_json_models.py -python test_dataset_crawler.py diff --git a/integrationtests/realworld_example/load_and_insert_json_models.py b/integrationtests/realworld_example/load_and_insert_json_models.py deleted file mode 100644 index 682fd9c7..00000000 --- a/integrationtests/realworld_example/load_and_insert_json_models.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env python3 -# encoding: utf-8 -# -# This file is a part of the CaosDB Project. -# -# Copyright (C) 2022 Indiscale GmbH <info@indiscale.com> -# Copyright (C) 2022 Henrik tom Wörden <h.tomwoerden@indiscale.com> -# Copyright (C) 2022 Florian Spreckelsen <f.spreckelsen@indiscale.com> -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <https://www.gnu.org/licenses/>. -# -import sys - -from caosadvancedtools.models.parser import parse_model_from_json_schema, parse_model_from_yaml - - -def main(): - # First load dataspace data model - dataspace_definitions = parse_model_from_json_schema( - "schema/dataspace.schema.json") - dataspace_definitions.sync_data_model(noquestion=True) - - # Then general dataset definitions - dataset_definitions = parse_model_from_json_schema( - "schema/dataset.schema.json") - dataset_definitions.sync_data_model(noquestion=True) - - # Finally, add inheritances as defined in yaml - dataset_inherits = parse_model_from_yaml( - "schema/dataset-inheritance.yml") - dataset_inherits.sync_data_model(noquestion=True) - - -if __name__ == "__main__": - - sys.exit(main()) diff --git a/integrationtests/realworld_example/test_dataset_crawler.py b/integrationtests/realworld_example/test_dataset_crawler.py index 8713f490..d5a7d972 100644 --- a/integrationtests/realworld_example/test_dataset_crawler.py +++ b/integrationtests/realworld_example/test_dataset_crawler.py @@ -72,8 +72,17 @@ def usemodel(): dataset_inherits.sync_data_model(noquestion=True) +@pytest.fixture +def clear_database(): + # TODO(fspreck): Remove once the corresponding avdvancedtools function can + # be used. + ents = db.execute_query("FIND ENTITY WITH ID>99") + if ents: + ents.delete() + + def test_dataset( - # clear_database, + clear_database, usemodel): # json_file_path = rfp("test_directories", "single_file_test_data", "testjson.json") -- GitLab