summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
1d319a4)
Reduced cognitive complexity in validate_metadata method
Change-Id: I195971985214f54a44c56a2e425825251a91c83b
Issue-ID: VVP-294
Signed-off-by: Ezhilarasi <ezhrajam@in.ibm.com>
import pytest
from tests import cached_yaml as yaml
import pytest
from tests import cached_yaml as yaml
-from .helpers import validates
+from .helpers import validates, get_param
Return error message string or None if no errors.
"""
for value in metadata.values():
Return error message string or None if no errors.
"""
for value in metadata.values():
- if isinstance(value, dict):
- if "get_param" in value:
- if value["get_param"] == "workload_context":
- wc = parameters.get("workload_context", {})
- if wc.get("type") == "string":
- break
- else:
- return (
- 'must have parameter "workload_context"' ' of type "string"'
- )
- break
- else:
- return None
+ if get_param(value) == "workload_context" and parameters.get("workload_context", {}).get("type", "") != "string":
+ return 'must have parameter "workload_context" of type "string"'
+ else:
+ return None