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
173d1e2c
Commit
173d1e2c
authored
3 years ago
by
Florian Spreckelsen
Committed by
Timm Fitschen
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
TST: Add tests for SELECT updates
parent
bc7a11b4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!10
TST: Add tests for SELECT updates
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+6
-0
6 additions, 0 deletions
CHANGELOG.md
tests/test_select.py
+46
-0
46 additions, 0 deletions
tests/test_select.py
with
52 additions
and
0 deletions
CHANGELOG.md
+
6
−
0
View file @
173d1e2c
...
...
@@ -29,6 +29,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[
caosdb-server#132
](
https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/issues/132
)
*
Tests for missing obligatory Properties
[
caosdb-server#146
](
https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/issues/146
)
*
Tests for updates of SELECT results, two still marked as
`xfail`
until
[
caosdb-pylib#48
](
https://gitlab.indiscale.com/caosdb/src/caosdb-pylib/-/issues/48
)
and
[
caosdb-server#155
](
https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/issues/155
)
have been resolved.
### Changed (for changes in existing functionality)
...
...
This diff is collapsed.
Click to expand it.
tests/test_select.py
+
46
−
0
View file @
173d1e2c
...
...
@@ -5,6 +5,8 @@
#
# Copyright (C) 2018 Research Group Biomedical Physics,
# Max-Planck-Institute for Dynamics and Self-Organization Göttingen
# Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
# Copyright (C) 2021 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
...
...
@@ -25,6 +27,8 @@
@author: tf
"""
from
pytest
import
mark
,
raises
import
caosdb
as
db
...
...
@@ -530,3 +534,45 @@ def test_select_with_subtyping_semantics_and_name_duplicates():
db
.
Property
(
name
=
"
TestHousePart
"
,
description
=
"
This is a duplicate
"
,
datatype
=
db
.
TEXT
).
insert
(
unique
=
False
)
test_select_with_subtyping_semantics
()
def
test_select_update
():
"""
Ensure that the result of a SELECT query can
'
t be used for an
update (which might result in data loss).
"""
select_result
=
db
.
execute_query
(
"
SELECT name FROM RECORD TestHouse
"
)[
0
]
with
raises
(
db
.
CaosDBException
):
select_result
.
update
()
@mark.xfail
(
reason
=
"
see pylib issue #48 and server issue #155
"
)
def
test_select_update_with_parent
():
"""
Ensure that even with a valid parent, the result of a SELECT query
can
'
t be updated.
"""
test_house_rt
=
db
.
RecordType
(
name
=
"
TestHouse
"
).
retrieve
()
select_result
=
db
.
execute_query
(
"
SELECT name FROM RECORD TestHouse
"
)[
0
]
select_result
.
add_parent
(
test_house_rt
)
with
raises
(
db
.
CaosDBException
):
select_result
.
update
()
@mark.xfail
(
reason
=
"
see pylib issue #48 and server issue #155
"
)
def
test_select_update_with_force
():
"""
The update of the result of a SELECT query may be forced.
"""
test_house_rt
=
db
.
RecordType
(
name
=
"
TestHouse
"
).
retrieve
()
select_result
=
db
.
execute_query
(
"
SELECT name FROM RECORD TestHouse
"
)[
0
]
select_result
.
add_parent
(
test_house_rt
)
# TODO: The syntax may change here depending on the implementation
# of caosdb-pylib#48
select_result
.
update
(
force_incomplete
=
True
)
# only name has been selected and updated, so no properties remain:
rec
=
db
.
Record
(
name
=
select_result
.
name
).
retrieve
()
assert
len
(
rec
.
properties
)
==
0
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