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
3a3fac16
Verified
Commit
3a3fac16
authored
4 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
STY: autopep8'ed test_state and test_affiliation
parent
0cec1c7d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!3
F fsm
Pipeline
#6366
passed
4 years ago
Stage: cert
Stage: style
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_affiliation.py
+0
-1
0 additions, 1 deletion
tests/test_affiliation.py
tests/test_state.py
+7
-6
7 additions, 6 deletions
tests/test_state.py
with
7 additions
and
7 deletions
tests/test_affiliation.py
+
0
−
1
View file @
3a3fac16
...
@@ -65,7 +65,6 @@ def teardown():
...
@@ -65,7 +65,6 @@ def teardown():
def
test_affiliation_there
():
def
test_affiliation_there
():
par
=
db
.
RecordType
(
name
=
"
TestRT1
"
)
par
=
db
.
RecordType
(
name
=
"
TestRT1
"
)
ch
=
db
.
Record
(
name
=
"
TestRec
"
).
add_parent
(
par
)
ch
=
db
.
Record
(
name
=
"
TestRec
"
).
add_parent
(
par
)
print
(
ch
)
assert_is_not_none
(
ch
.
get_parent
(
"
TestRT1
"
))
assert_is_not_none
(
ch
.
get_parent
(
"
TestRT1
"
))
assert_true
(
hasattr
(
ch
.
get_parent
(
"
TestRT1
"
),
"
affiliation
"
))
assert_true
(
hasattr
(
ch
.
get_parent
(
"
TestRT1
"
),
"
affiliation
"
))
...
...
This diff is collapsed.
Click to expand it.
tests/test_state.py
+
7
−
6
View file @
3a3fac16
...
@@ -713,7 +713,7 @@ def test_unauthorized_final():
...
@@ -713,7 +713,7 @@ def test_unauthorized_final():
switch_to_test_user
(
"
normal
"
)
switch_to_test_user
(
"
normal
"
)
rec
.
state
=
None
rec
.
state
=
None
with
pytest
.
raises
(
db
.
TransactionError
)
as
exc
:
with
pytest
.
raises
(
db
.
TransactionError
)
as
exc
:
rec
.
update
(
sync
=
False
)
rec
.
update
(
sync
=
False
)
assert
"
You are not allowed to do this.
"
in
str
(
exc
.
value
)
assert
"
You are not allowed to do this.
"
in
str
(
exc
.
value
)
rec_retrieve
=
db
.
Record
(
id
=
rec
.
id
).
retrieve
()
rec_retrieve
=
db
.
Record
(
id
=
rec
.
id
).
retrieve
()
...
@@ -736,7 +736,7 @@ def test_unauthorized_initial():
...
@@ -736,7 +736,7 @@ def test_unauthorized_initial():
rec
.
state
=
db
.
State
(
model
=
"
Model1
"
,
name
=
"
State1
"
)
rec
.
state
=
db
.
State
(
model
=
"
Model1
"
,
name
=
"
State1
"
)
with
pytest
.
raises
(
db
.
TransactionError
)
as
exc
:
with
pytest
.
raises
(
db
.
TransactionError
)
as
exc
:
# normal user lacks the permission for the initial state
# normal user lacks the permission for the initial state
rec
.
update
(
sync
=
False
)
rec
.
update
(
sync
=
False
)
assert
"
You are not allowed to do this.
"
in
str
(
exc
.
value
)
assert
"
You are not allowed to do this.
"
in
str
(
exc
.
value
)
rec_retrieve
=
db
.
Record
(
id
=
rec
.
id
).
retrieve
()
rec_retrieve
=
db
.
Record
(
id
=
rec
.
id
).
retrieve
()
assert
rec_retrieve
.
state
is
None
assert
rec_retrieve
.
state
is
None
...
@@ -744,7 +744,7 @@ def test_unauthorized_initial():
...
@@ -744,7 +744,7 @@ def test_unauthorized_initial():
switch_to_test_user
(
"
team-leader
"
)
switch_to_test_user
(
"
team-leader
"
)
with
pytest
.
raises
(
db
.
TransactionError
)
as
exc
:
with
pytest
.
raises
(
db
.
TransactionError
)
as
exc
:
# it is not allowed to "steal" the entity with the state feature
# it is not allowed to "steal" the entity with the state feature
rec
.
update
(
sync
=
False
)
rec
.
update
(
sync
=
False
)
assert
"
You are not allowed to do this.
"
in
str
(
exc
.
value
)
assert
"
You are not allowed to do this.
"
in
str
(
exc
.
value
)
rec_retrieve
=
db
.
Record
(
id
=
rec
.
id
).
retrieve
()
rec_retrieve
=
db
.
Record
(
id
=
rec
.
id
).
retrieve
()
assert
rec_retrieve
.
state
is
None
assert
rec_retrieve
.
state
is
None
...
@@ -757,13 +757,15 @@ def test_unauthorized_initial():
...
@@ -757,13 +757,15 @@ def test_unauthorized_initial():
rec_update
.
update_acl
()
rec_update
.
update_acl
()
switch_to_test_user
(
"
team-leader
"
)
switch_to_test_user
(
"
team-leader
"
)
rec
.
update
(
sync
=
False
)
rec
.
update
(
sync
=
False
)
assert
rec
.
state
==
db
.
State
(
model
=
"
Model1
"
,
name
=
"
State1
"
)
assert
rec
.
state
==
db
.
State
(
model
=
"
Model1
"
,
name
=
"
State1
"
)
rec_retrieve
=
db
.
Record
(
id
=
rec
.
id
).
retrieve
()
rec_retrieve
=
db
.
Record
(
id
=
rec
.
id
).
retrieve
()
assert
rec_retrieve
.
state
==
db
.
State
(
model
=
"
Model1
"
,
name
=
"
State1
"
)
assert
rec_retrieve
.
state
==
db
.
State
(
model
=
"
Model1
"
,
name
=
"
State1
"
)
@pytest.mark.xfail
(
reason
=
"
This is a very special corner case bug with low severity
"
)
@pytest.mark.xfail
(
reason
=
"
This is a very special corner case bug with low severity
"
)
def
test_transitions_included_after_empty_update
():
def
test_transitions_included_after_empty_update
():
rec
=
db
.
Record
()
rec
=
db
.
Record
()
rec
.
description
=
"
old description
"
rec
.
description
=
"
old description
"
...
@@ -787,7 +789,6 @@ def test_transitions_included_after_empty_update():
...
@@ -787,7 +789,6 @@ def test_transitions_included_after_empty_update():
from_state
=
"
State2
"
,
from_state
=
"
State2
"
,
to_state
=
"
State2
"
)}
to_state
=
"
State2
"
)}
rec_update_2
=
rec_update
.
update
(
sync
=
False
)
rec_update_2
=
rec_update
.
update
(
sync
=
False
)
# this fails
# this fails
...
...
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