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
cf25e10b
Verified
Commit
cf25e10b
authored
3 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
STY: autopep8'ed test_importance
parent
1e2bd9af
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!9
Tests for obligatory properties
Pipeline
#8896
failed
3 years ago
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_importance.py
+18
-5
18 additions, 5 deletions
tests/test_importance.py
with
18 additions
and
5 deletions
tests/test_importance.py
+
18
−
5
View file @
cf25e10b
...
...
@@ -99,12 +99,23 @@ def test_obl_missing_parent_in_same_container():
c
=
db
.
Container
()
c
.
extend
([
rt1
,
rt2
])
# with raises(db.TransactionError) as exc:
# c.insert()
# assert exc.value == "asdf"
with
raises
(
db
.
TransactionError
)
as
exc
:
c
.
insert
()
assert
exc
.
value
.
errors
[
0
].
msg
==
"
An obligatory property is missing.
"
def
test_obl_missing_parent_in_same_container_override
():
p
=
db
.
Property
(
name
=
"
TestOblProperty
"
,
datatype
=
db
.
TEXT
).
insert
()
rt1
=
db
.
RecordType
(
name
=
"
TestRecordType1
"
)
rt1
.
add_property
(
name
=
"
TestOblProperty
"
,
importance
=
db
.
OBLIGATORY
)
# set container flag, override in rt2 (entity flag takes precedence here)
rt2
=
db
.
RecordType
(
name
=
"
TestRecordType2
"
)
rt2
.
add_parent
(
"
TestRecordType1
"
,
inheritance
=
db
.
NONE
)
rt2
.
set_flag
(
"
force-missing-obligatory
"
,
"
error
"
)
c
=
db
.
Container
()
c
.
extend
([
rt1
,
rt2
])
with
raises
(
db
.
TransactionError
)
as
exc
:
c
.
insert
(
flags
=
{
"
force-missing-obligatory
"
:
"
ignore
"
})
assert
exc
.
value
.
errors
[
0
].
msg
==
"
An obligatory property is missing.
"
...
...
@@ -147,6 +158,7 @@ def test_sub_property_of_obl_in_same_container():
c
.
extend
([
rt2
,
p2
])
c
.
insert
()
# everything ok!
def
test_illegal_flag_value
():
p
=
db
.
Property
(
name
=
"
TestOblProperty
"
,
datatype
=
db
.
TEXT
).
insert
()
p_dummy
=
db
.
Property
(
name
=
"
TestDummyProperty
"
,
datatype
=
db
.
TEXT
).
insert
()
...
...
@@ -163,4 +175,5 @@ def test_illegal_flag_value():
rt2
.
insert
()
# default behavior + warning
assert
exc
.
value
.
errors
[
0
].
msg
==
"
An obligatory property is missing.
"
assert
"
Illegal value for flag
'
force-missing-obligatory
'
.
"
in
[
w
.
description
for
w
in
rt2
.
get_warnings
()]
assert
"
Illegal value for flag
'
force-missing-obligatory
'
.
"
in
[
w
.
description
for
w
in
rt2
.
get_warnings
()]
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