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
e1b410d9
Unverified
Commit
e1b410d9
authored
4 years ago
by
Daniel
Browse files
Options
Downloads
Plain Diff
Merge branch 'dev' into f-fsm
parents
dd81d45a
7243a05e
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!3
F fsm
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
tests/test_query_version.py
+669
-0
669 additions, 0 deletions
tests/test_query_version.py
tests/test_version.py
+48
-8
48 additions, 8 deletions
tests/test_version.py
with
718 additions
and
8 deletions
CHANGELOG.md
+
1
−
0
View file @
e1b410d9
...
...
@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
in caosdb server which checks if quoted datetimes in queries are
evaluated correctly.
*
Test for
[
caosdb-server#99
](
https://gitlab.com/caosdb/caosdb-server/-/issues/99
)
.
*
Tests for retrieving older versions.
### Changed (for changes in existing functionality)
...
...
This diff is collapsed.
Click to expand it.
tests/test_query_version.py
0 → 100644
+
669
−
0
View file @
e1b410d9
This diff is collapsed.
Click to expand it.
tests/test_version.py
+
48
−
8
View file @
e1b410d9
...
...
@@ -40,8 +40,11 @@ def test_version_object():
from
caosdb.common.versioning
import
Version
def
insertion
(
name
=
"
TestRT
"
):
rt
=
c
.
RecordType
(
name
,
description
=
"
TestDescription1
"
).
insert
()
def
insertion
(
name
=
"
TestRT
"
,
parents
=
[]):
rt
=
c
.
RecordType
(
name
,
description
=
"
TestDescription1
"
)
for
par
in
parents
:
rt
.
add_parent
(
par
)
rt
.
insert
()
assert
rt
.
version
is
not
None
assert
rt
.
version
.
id
is
not
None
assert
rt
.
version
.
date
is
not
None
...
...
@@ -92,8 +95,9 @@ def test_update_description():
def
test_update_parent
():
par1
=
insertion
(
"
TestRTParent1
"
)
par2
=
insertion
(
"
TestRTParent2
"
)
superpar
=
insertion
(
"
TestRTParentSuper
"
)
par1
=
insertion
(
"
TestRTParent1
"
,
parents
=
[
superpar
])
par2
=
insertion
(
"
TestRTParent2
"
,
parents
=
[
superpar
])
rt
=
insertion
(
"
TestRTChild
"
)
assert
len
(
rt
.
get_parents
())
==
0
...
...
@@ -119,13 +123,16 @@ def test_update_parent():
assert
len
(
c
.
execute_query
(
"
FIND TestRTParent2
"
))
==
2
assert
c
.
execute_query
(
"
FIND TestRTChild
"
,
unique
=
True
).
id
==
rt
.
id
rt_head
=
c
.
Container
().
retrieve
(
query
=
str
(
rt
.
id
),
sync
=
False
)[
0
]
rt_head
=
c
.
Container
().
retrieve
(
query
=
str
(
rt
.
id
),
sync
=
False
,
flags
=
{
"
cache
"
:
"
false
"
})[
0
]
rt_v1
=
c
.
Container
().
retrieve
(
query
=
str
(
rt
.
id
)
+
"
@
"
+
first_version
.
id
,
sync
=
False
)[
0
]
sync
=
False
,
flags
=
{
"
cache
"
:
"
false
"
}
)[
0
]
rt_v2
=
c
.
Container
().
retrieve
(
query
=
str
(
rt
.
id
)
+
"
@
"
+
second_version
.
id
,
sync
=
False
)[
0
]
sync
=
False
,
flags
=
{
"
cache
"
:
"
false
"
}
)[
0
]
rt_v3
=
c
.
Container
().
retrieve
(
query
=
str
(
rt
.
id
)
+
"
@
"
+
third_version
.
id
,
sync
=
False
)[
0
]
sync
=
False
,
flags
=
{
"
cache
"
:
"
false
"
}
)[
0
]
assert
rt_head
.
version
==
third_version
assert
rt_v1
.
version
.
id
==
first_version
.
id
...
...
@@ -133,9 +140,11 @@ def test_update_parent():
assert
rt_v3
.
version
.
id
==
third_version
.
id
assert
len
(
rt_v3
.
get_parents
())
==
1
print
(
rt_v3
)
assert
rt_v3
.
get_parent
(
"
TestRTParent1
"
)
is
None
assert
rt_v3
.
get_parent
(
"
TestRTParent2
"
)
is
not
None
print
(
rt_v2
)
assert
len
(
rt_v2
.
get_parents
())
==
1
assert
rt_v2
.
get_parent
(
"
TestRTParent1
"
)
is
not
None
assert
rt_v2
.
get_parent
(
"
TestRTParent2
"
)
is
None
...
...
@@ -390,6 +399,37 @@ def test_bug_cached_parent_name_in_old_version():
assert
old_rec
.
get_parent
(
del_rt_name
)
is
None
@mark.xfail
(
reason
=
"
bug fix needed
"
)
def
test_bug_parent_name_in_old_version
():
"""
mysql backend return current name even if this historically not
correct.
"""
OLD_NAME
=
"
TestRT1_old
"
NEW_NAME
=
"
TestRT1_cur
"
rt
=
c
.
RecordType
(
name
=
OLD_NAME
).
insert
()
rec
=
c
.
Record
(
name
=
"
TestRec
"
).
add_parent
(
rt
)
rec
.
insert
()
rec
.
description
=
"
v2
"
rec
.
update
()
rec_v1
=
c
.
Container
().
retrieve
(
str
(
rec
.
id
)
+
"
@HEAD~1
"
,
sync
=
False
,
flags
=
{
"
cache
"
:
"
false
"
},
raise_exception_on_error
=
False
)[
0
]
rec_v2
=
c
.
Container
().
retrieve
(
str
(
rec
.
id
)
+
"
@HEAD
"
,
sync
=
False
,
flags
=
{
"
cache
"
:
"
false
"
},
raise_exception_on_error
=
False
)[
0
]
assert
[
OLD_NAME
]
==
[
p
.
name
for
p
in
rec_v2
.
get_parents
()]
assert
[
OLD_NAME
]
==
[
p
.
name
for
p
in
rec_v1
.
get_parents
()]
# change parent
rt
.
name
=
NEW_NAME
assert
[
NEW_NAME
]
==
[
p
.
name
for
p
in
rec_v2
.
get_parents
()]
assert
[
OLD_NAME
]
==
[
p
.
name
for
p
in
rec_v1
.
get_parents
()]
def
test_reference_deleted_in_old_version
():
ref_rt
=
insertion
(
"
TestReferencedObject
"
)
rt
=
insertion
(
"
TestRT
"
)
...
...
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