Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
b321abec
Commit
b321abec
authored
1 year ago
by
Adam Laskowski
Browse files
Options
Downloads
Patches
Plain Diff
SSDM-13697: Fixed how plugins are being assigned to entities.
parent
d01fdb5e
No related branches found
No related tags found
1 merge request
!40
SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api-openbis-python3-pybis/src/python/pybis/entity_type.py
+4
-1
4 additions, 1 deletion
api-openbis-python3-pybis/src/python/pybis/entity_type.py
api-openbis-python3-pybis/src/python/tests/test_plugin.py
+60
-5
60 additions, 5 deletions
api-openbis-python3-pybis/src/python/tests/test_plugin.py
with
64 additions
and
6 deletions
api-openbis-python3-pybis/src/python/pybis/entity_type.py
+
4
−
1
View file @
b321abec
...
...
@@ -186,7 +186,10 @@ class EntityType:
# assign plugin
if
plugin
is
not
None
:
plugin_obj
=
self
.
openbis
.
get_plugin
(
plugin
)
new_assignment
[
"
plugin
"
]
=
plugin_obj
.
permId
new_assignment
[
"
pluginId
"
]
=
{
"
@type
"
:
'
as.dto.plugin.id.PluginPermId
'
,
"
permId
"
:
plugin_obj
.
permId
}
request
=
self
.
_get_request_for_pa
(
new_assignment
,
"
Add
"
)
try
:
...
...
This diff is collapsed.
Click to expand it.
api-openbis-python3-pybis/src/python/tests/test_plugin.py
+
60
−
5
View file @
b321abec
...
...
@@ -12,13 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import
json
import
re
import
pytest
import
time
from
pybis
import
DataSet
from
pybis
import
Openbis
import
uuid
import
pytest
def
test_create_delete_plugin
(
openbis_instance
):
...
...
@@ -50,6 +48,7 @@ def test_create_delete_plugin(openbis_instance):
pl_not_exists
=
openbis_instance
.
get_plugin
(
plugin
.
name
)
assert
pl_not_exists
is
None
def
test_search_plugins
(
openbis_instance
):
plugins
=
openbis_instance
.
get_plugins
(
start_with
=
1
,
count
=
1
)
assert
len
(
plugins
)
==
1
...
...
@@ -59,3 +58,59 @@ def test_search_plugins(openbis_instance):
plugin
=
plugins
[
0
]
assert
plugin
.
__class__
.
__name__
==
'
Plugin
'
def
test_assign_plugin_to_sample_type
(
openbis_instance
):
timestamp
=
time
.
strftime
(
"
%a_%y%m%d_%H%M%S
"
).
upper
()
plugin_name
=
'
TEST.NEW_PLUGIN_
'
+
timestamp
+
"
_
"
+
str
(
uuid
.
uuid4
())
pl
=
openbis_instance
.
new_plugin
(
name
=
plugin_name
,
pluginType
=
'
DYNAMIC_PROPERTY
'
,
entityKind
=
'
SAMPLE
'
,
script
=
'
def validate(x, True):
\n\t
return
"
OK
"'
)
pl
.
save
()
sample_type_code
=
'
SOME_TEST_SAMPLE_TYPE_
'
+
timestamp
+
"
_
"
+
str
(
uuid
.
uuid4
())
sample_type
=
openbis_instance
.
new_sample_type
(
code
=
sample_type_code
,
generatedCodePrefix
=
'
STST-
'
,
autoGeneratedCode
=
True
)
sample_type
.
save
()
sample_type
=
openbis_instance
.
get_sample_type
(
sample_type_code
)
assignments
=
sample_type
.
get_property_assignments
().
df
assert
len
(
assignments
)
==
0
property_code
=
'
SOME_TEST_PROPERTY_
'
+
timestamp
+
"
_
"
+
str
(
uuid
.
uuid4
())
prop_type
=
openbis_instance
.
new_property_type
(
code
=
property_code
,
label
=
'
test property
'
,
description
=
'
test property
'
,
dataType
=
'
VARCHAR
'
,
)
prop_type
.
save
()
sample_type
.
assign_property
(
prop_type
,
section
=
'
General info
'
,
ordinal
=
2
,
initialValueForExistingEntities
=
''
,
plugin
=
plugin_name
)
assignments
=
sample_type
.
get_property_assignments
().
df
assert
len
(
assignments
)
==
1
assert
assignments
.
loc
[
0
][
'
plugin
'
]
==
plugin_name
sample
=
openbis_instance
.
new_sample
(
type
=
sample_type
.
code
,
space
=
'
DEFAULT
'
,
experiment
=
'
/DEFAULT/DEFAULT/DEFAULT
'
,
props
=
{
property_code
.
lower
():
"
some_value
"
}
)
sample
.
save
()
sample_type
.
revoke_property
(
property_code
,
force
=
True
)
assignments
=
sample_type
.
get_property_assignments
().
df
assert
len
(
assignments
)
==
0
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