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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Python Integration Tests
Commits
755b87c0
Commit
755b87c0
authored
3 years ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Patches
Plain Diff
TST: Add integration test for
https://gitlab.com/caosdb/caosdb-server/-/issues/136
parent
1394cea0
No related branches found
No related tags found
1 merge request
!34
TST: Add integration test for https://gitlab.com/caosdb/caosdb-server/-/issues/136
Pipeline
#23276
canceled
3 years ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_issues_server.py
+47
-7
47 additions, 7 deletions
tests/test_issues_server.py
with
47 additions
and
7 deletions
tests/test_issues_server.py
+
47
−
7
View file @
755b87c0
...
...
@@ -713,7 +713,8 @@ def test_134_1():
"""
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_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
()
...
...
@@ -724,14 +725,17 @@ def test_134_1():
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
()
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
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
():
...
...
@@ -741,7 +745,8 @@ def test_134_2():
"""
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_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
()
...
...
@@ -758,5 +763,40 @@ def test_134_2():
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
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
def
test_136
():
"""
Faulty creation of a multi-property when updating a non-list property
with a list value.
https://gitlab.com/caosdb/caosdb-server/-/issues/136
"""
# @author Florian Spreckelsen
# @date 2022-05-23
# Insert data model:
rt
=
db
.
RecordType
(
name
=
"
TestBug
"
)
p
=
db
.
Property
(
name
=
"
TestBugProperty
"
,
datatype
=
db
.
INTEGER
)
db
.
Container
().
extend
([
rt
,
p
]).
insert
()
# Insert test record:
r
=
db
.
Record
(
name
=
"
TestRecord
"
)
r
.
add_parent
(
rt
)
r
.
add_property
(
p
,
value
=
18
)
r
.
insert
()
# Update the record:
test_r
=
db
.
Record
(
id
=
r
.
id
,
name
=
"
TestRecord
"
)
test_r
.
add_parent
(
rt
)
test_r
.
add_property
(
id
=
p
.
id
,
value
=
[
18
,
12
])
with
pytest
.
raises
(
db
.
TransactionError
)
as
cm
:
test_r
.
update
()
te
=
err
.
value
assert
te
.
has_error
(
db
.
UnqualifiedPropertiesError
)
assert
"
Cannot parse value to integer
"
in
str
(
te
)
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