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
089b8804
Verified
Commit
089b8804
authored
4 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
WIP: entity state
parent
da28ee7e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!3
F fsm
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_state.py
+39
-4
39 additions, 4 deletions
tests/test_state.py
with
39 additions
and
4 deletions
tests/test_state.py
+
39
−
4
View file @
089b8804
...
...
@@ -746,15 +746,14 @@ def test_unauthorized_initial():
# it is not allowed to "steal" the entity with the state feature
rec
.
update
(
sync
=
False
)
assert
"
You are not allowed to do this.
"
in
str
(
exc
.
value
)
rec_retrieve
=
db
.
Record
(
id
=
rec
.
id
).
retrieve
(
flags
=
{
"
ACL
"
:
None
}
)
rec_retrieve
=
db
.
Record
(
id
=
rec
.
id
).
retrieve
()
assert
rec_retrieve
.
state
is
None
# we need to give ownership to "team-leader"
switch_to_admin_user
()
rec_update
=
rec_retrieve
print
(
rec_update
.
acl
)
rec_update
=
db
.
Record
(
id
=
rec
.
id
).
retrieve
(
flags
=
{
"
ACL
"
:
None
})
rec_update
.
acl
.
grant
(
role
=
"
team-leader
"
,
permission
=
"
EDIT:ACL
"
)
print
(
rec_update
.
acl
)
rec_update
.
acl
.
grant
(
role
=
"
team-leader
"
,
permission
=
"
RETRIEVE:ACL
"
)
rec_update
.
update_acl
()
switch_to_test_user
(
"
team-leader
"
)
...
...
@@ -763,3 +762,39 @@ def test_unauthorized_initial():
rec_retrieve
=
db
.
Record
(
id
=
rec
.
id
).
retrieve
()
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
"
)
def
test_transitions_included_after_empty_update
():
rec
=
db
.
Record
()
rec
.
description
=
"
old description
"
rec
.
add_parent
(
"
TestRT
"
)
rec
.
state
=
db
.
State
(
model
=
"
Model1
"
,
name
=
"
State1
"
)
rec_insert
=
rec
.
insert
(
sync
=
False
)
assert
rec_insert
.
state
.
transitions
is
not
None
assert
rec_insert
.
state
.
transitions
==
{
db
.
Transition
(
name
=
"
Transition1
"
,
from_state
=
"
State1
"
,
to_state
=
"
State2
"
)}
rec_insert
.
description
=
"
new_description
"
rec_insert
.
state
=
db
.
State
(
model
=
"
Model1
"
,
name
=
"
State2
"
)
rec_update
=
rec_insert
.
update
(
sync
=
False
)
assert
rec_update
.
state
.
transitions
is
not
None
assert
rec_update
.
state
.
transitions
==
{
db
.
Transition
(
name
=
"
Transition2
"
,
from_state
=
"
State2
"
,
to_state
=
"
State3
"
),
db
.
Transition
(
name
=
"
Transition4
"
,
from_state
=
"
State2
"
,
to_state
=
"
State2
"
)}
rec_update_2
=
rec_update
.
update
(
sync
=
False
)
# this fails
assert
rec_update_2
.
state
.
transitions
is
not
None
assert
rec_update_2
.
state
.
transitions
==
{
db
.
Transition
(
name
=
"
Transition1
"
,
from_state
=
"
State1
"
,
to_state
=
"
State2
"
),
db
.
Transition
(
name
=
"
Transition4
"
,
from_state
=
"
State2
"
,
to_state
=
"
State2
"
)}
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