Skip to content
Snippets Groups Projects

Helper for CreateMetaDataBulk

Merged Thibault Lavigne requested to merge helper-for-create-metadatabulk into master
2 files
+ 60
25
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -129,28 +129,27 @@ class MetaDataMixin(object):
metadata_list, list
), "type shouldn't be null and should be of type list of MetaDataBulkItem"
assert (
len(metadata_list) >= 3
), "The metadata_list does not contain the correct amount of data"
type = metadata_list[0]
name = metadata_list[1]
value = metadata_list[2]
assert type and isinstance(
type, MetaType
), "name shouldn't be null and should be of type MetaType"
assert name and isinstance(
name, str
), "name shouldn't be null and should be of type str"
assert (
value and isinstance(value, str) or value and isinstance(value, float)
), "value shouldn't be null and should be of type str or float"
if len(metadata_list) > 3:
entity_id = metadata_list[3]
for index, metadata in enumerate(metadata_list):
assert isinstance(
metadata, dict
), f"Element at index {index} in metadata_list: Should be of type dict"
type = metadata.get("type")
name = metadata.get("name")
value = metadata.get("value")
entity_id = metadata.get("entity_id")
assert type and isinstance(
type, MetaType
), f"Element at index {index} in metadata_list: type shouldn't be null and should be of type MetaType"
assert name and isinstance(
name, str
), f"Element at index {index} in metadata_list: name shouldn't be null and should be of type str"
assert (
value and isinstance(value, str) or value and isinstance(value, float)
), f"Element at index {index} in metadata_list: value shouldn't be null and should be of type str or number"
assert entity_id is None or isinstance(
entity_id, str
), "entity_id should be None or a str"
), f"Element at index {index} in metadata_list: entity_id should be None or a str"
metadatabulk = self.request(
"CreateMetaDataBulk",
Loading