Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-advanced-user-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-advanced-user-tools
Commits
d2e0adf1
Commit
d2e0adf1
authored
2 years ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Patches
Plain Diff
TST: Add integration test for name in extern keywords
parent
049776f4
No related branches found
No related tags found
2 merge requests
!39
Release 0.4.0
,
!37
F extern name
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
integrationtests/test.sh
+3
-0
3 additions, 0 deletions
integrationtests/test.sh
integrationtests/test_yaml_parser.py
+61
-0
61 additions, 0 deletions
integrationtests/test_yaml_parser.py
with
64 additions
and
0 deletions
integrationtests/test.sh
+
3
−
0
View file @
d2e0adf1
...
...
@@ -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!!!"
This diff is collapsed.
Click to expand it.
integrationtests/test_yaml_parser.py
0 → 100644
+
61
−
0
View file @
d2e0adf1
# 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
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment