Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CaosDB Crawler
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 Crawler
Commits
03b1d0aa
Commit
03b1d0aa
authored
3 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
TST: Add unittest for loading identifiables from a yaml file
parent
b73097db
No related branches found
No related tags found
2 merge requests
!53
Release 0.1
,
!17
F load identifiables from yaml
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
unittests/test_directories/single_file_test_data/identifiables.yml
+7
-0
7 additions, 0 deletions
.../test_directories/single_file_test_data/identifiables.yml
unittests/test_identifiable_adapters.py
+27
-1
27 additions, 1 deletion
unittests/test_identifiable_adapters.py
with
34 additions
and
1 deletion
unittests/test_directories/single_file_test_data/identifiables.yml
0 → 100644
+
7
−
0
View file @
03b1d0aa
Person
:
-
full_name
Keyword
:
-
name
Project
:
-
project_id
-
title
This diff is collapsed.
Click to expand it.
unittests/test_identifiable_adapters.py
+
27
−
1
View file @
03b1d0aa
...
...
@@ -27,8 +27,10 @@
test identifiable_adapters module
"""
import
os
from
datetime
import
datetime
from
newcrawler.identifiable_adapters
import
IdentifiableAdapter
from
newcrawler.identifiable_adapters
import
(
CaosDBIdentifiableAdapter
,
IdentifiableAdapter
)
import
caosdb
as
db
...
...
@@ -57,3 +59,27 @@ def test_create_query_for_identifiable():
query
=
IdentifiableAdapter
.
create_query_for_identifiable
(
db
.
Record
(
name
=
"
TestRecord
"
).
add_parent
(
"
TestType
"
))
assert
query
.
lower
()
==
"
find record testtype with name=
'
testrecord
'"
def
test_load_from_yaml_file
():
ident
=
CaosDBIdentifiableAdapter
()
ident
.
load_from_yaml_definition
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"
test_directories
"
,
"
single_file_test_data
"
,
"
identifiables.yml
"
)
)
person_i
=
ident
.
get_registered_identifiable
(
db
.
Record
().
add_parent
(
"
Person
"
))
assert
person_i
is
not
None
assert
person_i
.
get_property
(
"
full_name
"
)
is
not
None
keyword_i
=
ident
.
get_registered_identifiable
(
db
.
Record
().
add_parent
(
"
Keyword
"
))
assert
keyword_i
is
not
None
assert
keyword_i
.
get_property
(
"
name
"
)
is
not
None
project_i
=
ident
.
get_registered_identifiable
(
db
.
Record
().
add_parent
(
"
Project
"
))
assert
project_i
is
not
None
assert
project_i
.
get_property
(
"
project_id
"
)
is
not
None
assert
project_i
.
get_property
(
"
title
"
)
is
not
None
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