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
926ec1e6
Verified
Commit
926ec1e6
authored
4 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
Add further bug confirmation tests
parent
f3900f30
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_version.py
+47
-8
47 additions, 8 deletions
tests/test_version.py
with
47 additions
and
8 deletions
tests/test_version.py
+
47
−
8
View file @
926ec1e6
...
@@ -40,8 +40,11 @@ def test_version_object():
...
@@ -40,8 +40,11 @@ def test_version_object():
from
caosdb.common.versioning
import
Version
from
caosdb.common.versioning
import
Version
def
insertion
(
name
=
"
TestRT
"
):
def
insertion
(
name
=
"
TestRT
"
,
parents
=
[]):
rt
=
c
.
RecordType
(
name
,
description
=
"
TestDescription1
"
).
insert
()
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
is
not
None
assert
rt
.
version
.
id
is
not
None
assert
rt
.
version
.
id
is
not
None
assert
rt
.
version
.
date
is
not
None
assert
rt
.
version
.
date
is
not
None
...
@@ -92,8 +95,9 @@ def test_update_description():
...
@@ -92,8 +95,9 @@ def test_update_description():
def
test_update_parent
():
def
test_update_parent
():
par1
=
insertion
(
"
TestRTParent1
"
)
superpar
=
insertion
(
"
TestRTParentSuper
"
)
par2
=
insertion
(
"
TestRTParent2
"
)
par1
=
insertion
(
"
TestRTParent1
"
,
parents
=
[
superpar
])
par2
=
insertion
(
"
TestRTParent2
"
,
parents
=
[
superpar
])
rt
=
insertion
(
"
TestRTChild
"
)
rt
=
insertion
(
"
TestRTChild
"
)
assert
len
(
rt
.
get_parents
())
==
0
assert
len
(
rt
.
get_parents
())
==
0
...
@@ -119,13 +123,13 @@ def test_update_parent():
...
@@ -119,13 +123,13 @@ def test_update_parent():
assert
len
(
c
.
execute_query
(
"
FIND TestRTParent2
"
))
==
2
assert
len
(
c
.
execute_query
(
"
FIND TestRTParent2
"
))
==
2
assert
c
.
execute_query
(
"
FIND TestRTChild
"
,
unique
=
True
).
id
==
rt
.
id
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
,
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
,
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
,
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_head
.
version
==
third_version
assert
rt_v1
.
version
.
id
==
first_version
.
id
assert
rt_v1
.
version
.
id
==
first_version
.
id
...
@@ -133,9 +137,11 @@ def test_update_parent():
...
@@ -133,9 +137,11 @@ def test_update_parent():
assert
rt_v3
.
version
.
id
==
third_version
.
id
assert
rt_v3
.
version
.
id
==
third_version
.
id
assert
len
(
rt_v3
.
get_parents
())
==
1
assert
len
(
rt_v3
.
get_parents
())
==
1
print
(
rt_v3
)
assert
rt_v3
.
get_parent
(
"
TestRTParent1
"
)
is
None
assert
rt_v3
.
get_parent
(
"
TestRTParent1
"
)
is
None
assert
rt_v3
.
get_parent
(
"
TestRTParent2
"
)
is
not
None
assert
rt_v3
.
get_parent
(
"
TestRTParent2
"
)
is
not
None
print
(
rt_v2
)
assert
len
(
rt_v2
.
get_parents
())
==
1
assert
len
(
rt_v2
.
get_parents
())
==
1
assert
rt_v2
.
get_parent
(
"
TestRTParent1
"
)
is
not
None
assert
rt_v2
.
get_parent
(
"
TestRTParent1
"
)
is
not
None
assert
rt_v2
.
get_parent
(
"
TestRTParent2
"
)
is
None
assert
rt_v2
.
get_parent
(
"
TestRTParent2
"
)
is
None
...
@@ -390,6 +396,39 @@ def test_bug_cached_parent_name_in_old_version():
...
@@ -390,6 +396,39 @@ def test_bug_cached_parent_name_in_old_version():
assert
old_rec
.
get_parent
(
del_rt_name
)
is
None
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
():
def
test_reference_deleted_in_old_version
():
ref_rt
=
insertion
(
"
TestReferencedObject
"
)
ref_rt
=
insertion
(
"
TestReferencedObject
"
)
rt
=
insertion
(
"
TestRT
"
)
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