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
b9a1579a
Verified
Commit
b9a1579a
authored
4 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
TST: for disabled EXT_STATE_ENTITY
parent
a0f4c836
No related branches found
No related tags found
1 merge request
!3
F fsm
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_state.py
+40
-0
40 additions, 0 deletions
tests/test_state.py
with
40 additions
and
0 deletions
tests/test_state.py
+
40
−
0
View file @
b9a1579a
import
pytest
import
caosdb
as
db
from
caosdb
import
administration
as
admin
_ORIGINAL_EXT_ENTITY_STATE
=
""
def
teardown_module
():
d
=
db
.
execute_query
(
"
FIND ENTITY WITH ID > 99
"
)
if
len
(
d
)
>
0
:
d
.
delete
(
flags
=
{
"
forceFinalState
"
:
"
true
"
})
admin
.
set_server_property
(
"
EXT_ENTITY_STATE
"
,
_ORIGINAL_EXT_ENTITY_STATE
)
def
setup_module
():
global
_ORIGINAL_EXT_ENTITY_STATE
try
:
_ORIGINAL_EXT_ENTITY_STATE
=
admin
.
get_server_property
(
"
EXT_ENTITY_STATE
"
)
except
KeyError
:
pass
teardown_module
()
db
.
RecordType
(
"
State
"
).
insert
()
db
.
RecordType
(
"
StateModel
"
).
insert
()
...
...
@@ -55,10 +66,39 @@ def teardown():
def
setup
():
admin
.
set_server_property
(
"
EXT_ENTITY_STATE
"
,
"
ENABLED
"
)
teardown
()
db
.
RecordType
(
"
TestRT
"
).
insert
()
def
test_plugin_disabled
():
admin
.
set_server_property
(
"
EXT_ENTITY_STATE
"
,
"
DISABLED
"
)
rec
=
db
.
Record
()
rec
.
add_parent
(
"
TestRT
"
)
rec
.
state
=
db
.
State
(
model
=
"
Model1
"
,
name
=
"
State1
"
)
assert
rec
.
get_property
(
"
State
"
)
is
None
rec_insert
=
rec
.
insert
(
sync
=
False
)
assert
rec_insert
.
get_property
(
"
State
"
)
is
None
assert
rec_insert
.
state
==
rec
.
state
# however, state was not stored
rec_retrieve
=
db
.
Record
.
retrieve
(
rec_insert
.
id
)
assert
rec_retrieve
.
get_property
(
"
State
"
)
is
None
assert
rec_retrieve
.
state
is
None
# also, properties are not interpreted as state
rec
=
db
.
Record
()
rec
.
add_parent
(
"
TestRT
"
)
rec
.
add_property
(
"
State
"
,
"
State2
"
)
rec_insert
=
rec
.
insert
(
sync
=
False
)
rec_retrieve
=
db
.
Record
.
retrieve
(
rec_insert
.
id
)
assert
rec_retrieve
.
get_property
(
"
State
"
).
value
is
not
None
assert
rec_retrieve
.
state
is
None
def
test_state_message
():
rec
=
db
.
Record
()
rec
.
add_parent
(
"
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