Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CaosDB Python Integration Tests
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Python Integration Tests
Commits
c44a06e4
Commit
c44a06e4
authored
May 6, 2022
by
florian
Browse files
Options
Downloads
Plain Diff
Merge branch 'dev' into f-cleanup-ci
parents
bc09f558
cb2cf641
No related branches found
No related tags found
1 merge request
!33
MAINT: comments and minor clean up
Pipeline
#22637
passed
May 6, 2022
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_issues_server.py
+57
-1
57 additions, 1 deletion
tests/test_issues_server.py
tests/test_name_properties.py
+25
-1
25 additions, 1 deletion
tests/test_name_properties.py
with
82 additions
and
2 deletions
tests/test_issues_server.py
+
57
−
1
View file @
c44a06e4
...
...
@@ -44,7 +44,7 @@ def setup_function(function):
def
teardown_function
(
function
):
"""
Deleting entities again.
"""
setup_module
()
pass
#
setup_module()
# ########################### Issue tests start here #####################
...
...
@@ -704,3 +704,59 @@ def test_issue_221():
assert
r2
.
get_property
(
"
B
"
).
value
==
7
assert
r2
.
get_property
(
"
B
"
).
datatype
==
db
.
INTEGER
assert
r2
.
get_property
(
"
B
"
).
id
==
p
.
id
def
test_134_1
():
"""
CQL: Subproperties are not recognized in list of references.
https://gitlab.com/caosdb/caosdb-server/-/issues/134
"""
p_lng
=
db
.
Property
(
name
=
"
longitude
"
,
datatype
=
db
.
DOUBLE
).
insert
()
p_lat
=
db
.
Property
(
name
=
"
latitude
"
,
datatype
=
db
.
DOUBLE
).
insert
()
rt_ev
=
db
.
RecordType
(
name
=
"
Event
"
).
add_property
(
p_lng
).
add_property
(
p_lat
).
insert
()
p_ev
=
db
.
Property
(
name
=
"
events
"
,
datatype
=
db
.
LIST
(
rt_ev
)).
insert
()
rt_ds
=
db
.
RecordType
(
name
=
"
DataSet
"
).
add_property
(
p_ev
).
insert
()
r_ev_1
=
db
.
Record
().
add_parent
(
"
Event
"
).
add_property
(
"
longitude
"
,
0.1
).
add_property
(
"
latitude
"
,
0.1
).
insert
()
r_ev_2
=
db
.
Record
().
add_parent
(
"
Event
"
).
add_property
(
"
longitude
"
,
0.2
).
add_property
(
"
latitude
"
,
0.2
).
insert
()
r_ds
=
db
.
Record
().
add_parent
(
"
DataSet
"
).
add_property
(
"
events
"
,
value
=
[
r_ev_1
,
r_ev_2
]).
insert
()
result
=
db
.
execute_query
(
"
SELECT events.latitude FROM RECORD DataSet
"
,
unique
=
True
)
print
(
result
)
assert
len
(
result
.
get_property
(
"
events
"
).
value
)
==
2
assert
result
.
get_property
(
"
events
"
).
value
[
0
].
get_property
(
"
latitude
"
).
value
==
0.1
assert
result
.
get_property
(
"
events
"
).
value
[
1
].
get_property
(
"
latitude
"
).
value
==
0.2
def
test_134_2
():
"""
CQL: Subproperties are not recognized in list of references.
https://gitlab.com/caosdb/caosdb-server/-/issues/134
"""
p_lng
=
db
.
Property
(
name
=
"
longitude
"
,
datatype
=
db
.
DOUBLE
).
insert
()
p_lat
=
db
.
Property
(
name
=
"
latitude
"
,
datatype
=
db
.
DOUBLE
).
insert
()
rt_ev
=
db
.
RecordType
(
name
=
"
Event
"
).
add_property
(
p_lng
).
add_property
(
p_lat
).
insert
()
rt_ds
=
db
.
RecordType
(
name
=
"
DataSet
"
).
add_property
(
name
=
"
Event
"
,
datatype
=
db
.
LIST
(
rt_ev
)).
insert
()
r_ev_1
=
db
.
Record
().
add_parent
(
"
Event
"
).
add_property
(
"
longitude
"
,
0.1
).
add_property
(
"
latitude
"
,
0.1
).
insert
()
r_ev_2
=
db
.
Record
().
add_parent
(
"
Event
"
).
add_property
(
"
longitude
"
,
0.2
).
add_property
(
"
latitude
"
,
0.2
).
insert
()
r_ds
=
db
.
Record
().
add_parent
(
"
DataSet
"
).
add_property
(
"
Event
"
,
datatype
=
db
.
LIST
(
rt_ev
),
value
=
[
r_ev_1
,
r_ev_2
]).
insert
()
result
=
db
.
execute_query
(
"
SELECT Event.latitude FROM RECORD DataSet
"
,
unique
=
True
)
assert
len
(
result
.
get_property
(
"
Event
"
).
value
)
==
2
assert
result
.
get_property
(
"
Event
"
).
value
[
0
].
get_property
(
"
latitude
"
).
value
==
0.1
assert
result
.
get_property
(
"
Event
"
).
value
[
1
].
get_property
(
"
latitude
"
).
value
==
0.2
This diff is collapsed.
Click to expand it.
tests/test_name_properties.py
+
25
−
1
View file @
c44a06e4
...
...
@@ -27,7 +27,7 @@
"""
import
caosdb
as
db
from
pytest
import
raises
from
pytest
import
raises
,
mark
from
nose.tools
import
assert_true
,
assert_equal
...
...
@@ -351,3 +351,27 @@ def test_query_with_back_reference():
"
FIND TestPerson WHICH IS REFERENCED BY TestObservation AS A TestConductor
"
,
unique
=
True
).
id
,
rec
.
id
)
@mark.xfail
(
reason
=
"
Enhancement proposed
"
)
def
test_name_resource
():
name_prop
=
db
.
Property
(
name
=
"
name
"
).
retrieve
()
alias_prop
=
db
.
Property
(
name
=
"
TestAlias
"
).
add_parent
(
name_prop
).
insert
()
rt
=
db
.
RecordType
(
name
=
"
TestRT_primary
"
).
add_property
(
alias_prop
,
value
=
"
TestRT_alias
"
).
insert
()
connection
=
db
.
get_connection
()
flags
=
{
"
names
"
:
None
}
http_response
=
connection
.
retrieve
(
entity_uri_segments
=
[
"
Entity
"
],
query_dict
=
flags
)
result
=
db
.
Container
.
_response_to_entities
(
http_response
)
print
(
result
)
names
=
[
e
.
name
for
e
in
result
]
assert
"
TestRT_primary
"
in
names
assert
"
TestRT_alias
"
in
names
# the alias should also be included"
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