UnitTestLoadContextList
python · Content Testing
Details
| ID | UnitTestLoadContextList |
|---|---|
| Language | python |
| From Version | 6.0.0 |
| Docker Image | demisto/python3:3.12.8.3296088 |
README
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
Inputs
| Argument Name | Description |
|---|---|
| list | List to Load Context From |
Outputs
There are no outputs for this script.
import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 def main(): try: listName = demisto.args()["list"] results = execute_command("getList", {"listName": listName}) if "Item not found" not in results: fields = json.loads(results) # Set context for key, val in fields.items(): execute_command("Set", {"key": key, "value": val}) else: raise DemistoException(f"UnitTestLoadContextList: list '{listName}' not found") except Exception as ex: raise ex if __name__ in ("__main__", "__builtin__", "builtins"): main()