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
611d48f7
Commit
611d48f7
authored
4 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
TST: Adapt test_version.py to new error handling
parent
e53c809e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_version.py
+10
-7
10 additions, 7 deletions
tests/test_version.py
with
10 additions
and
7 deletions
tests/test_version.py
+
10
−
7
View file @
611d48f7
...
@@ -205,10 +205,10 @@ def test_retrieve_relative_to_head():
...
@@ -205,10 +205,10 @@ def test_retrieve_relative_to_head():
assert
first_version
==
rt_head
.
version
,
"
head is first version
"
assert
first_version
==
rt_head
.
version
,
"
head is first version
"
# no HEAD~1 before first update
# no HEAD~1 before first update
with
raises
(
c
.
EntityDoesNotExist
Error
)
as
exc
:
with
raises
(
c
.
Transaction
Error
)
as
exc
:
# no head~2
# no head~2
c
.
Container
().
retrieve
(
query
=
str
(
rt
.
id
)
+
"
@HEAD~1
"
,
sync
=
False
)
c
.
Container
().
retrieve
(
query
=
str
(
rt
.
id
)
+
"
@HEAD~1
"
,
sync
=
False
)
assert
exc
.
value
.
has_error
(
c
.
EntityDoesNotExistError
)
# update
# update
rt
.
description
=
"
TestDescription4
"
rt
.
description
=
"
TestDescription4
"
rt
.
update
()
rt
.
update
()
...
@@ -237,9 +237,10 @@ def test_retrieve_relative_to_head():
...
@@ -237,9 +237,10 @@ def test_retrieve_relative_to_head():
assert
rt_pre_head
.
version
.
successors
[
0
].
id
==
rt_new_head
.
version
.
id
,
(
assert
rt_pre_head
.
version
.
successors
[
0
].
id
==
rt_new_head
.
version
.
id
,
(
"
successor of head~1 is head
"
)
"
successor of head~1 is head
"
)
with
raises
(
c
.
EntityDoesNotExist
Error
)
as
exc
:
with
raises
(
c
.
Transaction
Error
)
as
exc
:
# no head~2
# no head~2
c
.
Container
().
retrieve
(
query
=
str
(
rt
.
id
)
+
"
@HEAD~2
"
,
sync
=
False
)
c
.
Container
().
retrieve
(
query
=
str
(
rt
.
id
)
+
"
@HEAD~2
"
,
sync
=
False
)
assert
exc
.
value
.
has_error
(
c
.
EntityDoesNotExistError
)
@mark.xfail
(
reason
=
"
bug fix needed
"
)
@mark.xfail
(
reason
=
"
bug fix needed
"
)
...
@@ -256,9 +257,10 @@ def test_bug_cached_delete():
...
@@ -256,9 +257,10 @@ def test_bug_cached_delete():
c
.
execute_query
(
"
FIND RecordType TestRT
"
).
delete
()
c
.
execute_query
(
"
FIND RecordType TestRT
"
).
delete
()
with
raises
(
c
.
EntityDoesNotExist
Error
)
as
exc
:
with
raises
(
c
.
Transaction
Error
)
as
exc
:
c
.
Container
().
retrieve
(
query
=
str
(
rt
.
id
)
+
"
@
"
+
old_version
,
c
.
Container
().
retrieve
(
query
=
str
(
rt
.
id
)
+
"
@
"
+
old_version
,
sync
=
False
)[
0
]
sync
=
False
)[
0
]
assert
exc
.
value
.
has_error
(
c
.
EntityDoesNotExistError
)
@mark.xfail
(
reason
=
(
"
TODO: What is the desired behavior?
"
@mark.xfail
(
reason
=
(
"
TODO: What is the desired behavior?
"
...
@@ -420,7 +422,7 @@ def test_reference_deleted_in_old_version():
...
@@ -420,7 +422,7 @@ def test_reference_deleted_in_old_version():
rec
.
remove_property
(
ref_rt
)
rec
.
remove_property
(
ref_rt
)
rec
.
update
()
rec
.
update
()
with
raises
(
c
.
E
ntityDoesNotExist
Error
)
as
exc
:
with
raises
(
c
.
E
mptyUniqueQuery
Error
)
as
exc
:
c
.
execute_query
(
c
.
execute_query
(
"
FIND RECORD TestRec2 WHICH REFERENCES {}
"
.
format
(
"
FIND RECORD TestRec2 WHICH REFERENCES {}
"
.
format
(
referenced_rec
.
id
),
referenced_rec
.
id
),
...
@@ -461,12 +463,13 @@ def test_reference_deleted_in_old_version():
...
@@ -461,12 +463,13 @@ def test_reference_deleted_in_old_version():
assert
old_rec
.
get_property
(
p
).
value
==
"
blablabla
"
assert
old_rec
.
get_property
(
p
).
value
==
"
blablabla
"
assert
old_rec
.
get_property
(
ref_rt
).
value
==
referenced_id
assert
old_rec
.
get_property
(
ref_rt
).
value
==
referenced_id
with
raises
(
c
.
E
ntityDoesNotExist
Error
)
as
exc
:
with
raises
(
c
.
E
mptyUniqueQuery
Error
)
as
exc
:
c
.
execute_query
(
"
FIND ENTITY WITH ID = {}
"
.
format
(
referenced_id
),
c
.
execute_query
(
"
FIND ENTITY WITH ID = {}
"
.
format
(
referenced_id
),
unique
=
True
)
unique
=
True
)
with
raises
(
c
.
EntityDoesNotExist
Error
)
as
exc
:
with
raises
(
c
.
Transaction
Error
)
as
exc
:
c
.
Record
(
id
=
referenced_id
).
retrieve
()
c
.
Record
(
id
=
referenced_id
).
retrieve
()
assert
exc
.
value
.
has_error
(
c
.
EntityDoesNotExistError
)
def
test_reference_version_head
():
def
test_reference_version_head
():
...
...
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