Skip to content
Snippets Groups Projects
Commit d2e0adf1 authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

TST: Add integration test for name in extern keywords

parent 049776f4
No related branches found
No related tags found
2 merge requests!39Release 0.4.0,!37F extern name
......@@ -82,5 +82,8 @@ python3 -m pytest test_crawl_with_datamodel_problems.py
echo "Testing table export"
python3 -m pytest test_base_table_exporter_integration.py
echo "Testing yaml datamodel parser"
python3 -m pytest test_yaml_parser.py
# Obsolete due to teardown in the above test.
# echo "/n/n/n YOU NEED TO RESTART THE SERVER TO REDO TESTS!!!"
# encoding: utf-8
#
# This file is a part of the CaosDB Project.
#
# Copyright (C) 2022 IndiScale GmbH <info@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 caosdb as db
from caosadvancedtools.models.parser import parse_model_from_string
def _delete_everything():
ents = db.execute_query("FIND ENTITY WITH ID > 99")
if ents:
ents.delete()
def setup_module():
_delete_everything()
def teardown_module():
_delete_everything()
def test_name_in_extern():
"""Test adding the internal `name` property as a parent to an existing
property.
"""
model = """
extern:
- name
- test_name
test_name:
inherit_from_suggested:
- name
"""
db.Property(name="test_name", datatype=db.TEXT).insert()
ents = parse_model_from_string(model)
ents.sync_data_model(noquestion=True)
test_prop = db.Property(name="test_name").retrieve()
name_prop = db.Property(name="name").retrieve()
assert len(test_prop.parents) == 1
assert test_prop.has_parent(name_prop)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment