Skip to content

Commit

Permalink
Updating LO107 - XSIAM is now able to cope with canvas tab (#4544)
Browse files Browse the repository at this point in the history
* Updating LO107 - canvas is supported in xsiam now

* changelog

* LO107 unit tests fix

* update unit tests

* revert unecessary change

* eof

* unit tests fix

* unit tests fix

* unit tests fix

* unit tests fix
  • Loading branch information
barryyosi-panw authored Sep 15, 2024
1 parent 0ce12af commit ebbc2f4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 27 deletions.
4 changes: 4 additions & 0 deletions .changelog/4544.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changes:
- description: Discard 'canvas' tab from LO107 validation as it is now supported by XSIAM.
type: feature
pr_number: 4544
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,6 @@
"id": "relatedIncidents",
"name": "Related Incidents",
"type": "relatedIncidents"
},
{
"id": "canvas",
"name": "Canvas",
"type": "canvas"
}
]
},
Expand Down
25 changes: 4 additions & 21 deletions demisto_sdk/commands/validate/tests/LO_validators_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,12 @@
@pytest.mark.parametrize(
"paths, values, expected_field_error_messages",
[
pytest.param(
["detailsV2.tabs[0].type"],
["canvas"],
["canvas"],
id="Case1: Single invalid type in first tab",
),
pytest.param(
["detailsV2.tabs[1].sections[0].type"],
["evidence"],
["evidence"],
id="Case2: Single invalid type in a section of the second tab",
),
pytest.param(
["detailsV2.tabs[1].sections[0].type", "detailsV2.tabs[0].type"],
["evidence", "canvas"],
["canvas", "evidence"],
id="Case3: Multiple invalid types in different tabs",
),
id="Single invalid type in a section of the second tab",
)
],
)
def test_IsValidTypeValidator_obtain_invalid_content_items_failure(
Expand All @@ -39,9 +27,7 @@ def test_IsValidTypeValidator_obtain_invalid_content_items_failure(
):
"""
Given
Case1: a layout object with a single invalid type in the first tab,
Case2: a layout object with a single invalid type in a section of the second tab,
Case3: a layout object with multiple invalid types in different tabs,
Case: a layout object with a single invalid type in a section of the second tab,
When
the IsValidTypeValidator's obtain_invalid_content_items method is called with the layout object.
Then
Expand All @@ -57,7 +43,6 @@ def test_IsValidTypeValidator_obtain_invalid_content_items_failure(
"detailsV2.tabs[1].sections[3].type",
"detailsV2.tabs[4].type",
"detailsV2.tabs[5].type",
"detailsV2.tabs[6].type",
]
)
values.extend(
Expand All @@ -66,7 +51,6 @@ def test_IsValidTypeValidator_obtain_invalid_content_items_failure(
"dynamic",
"dynamic",
"dynamic",
"dynamic",
]
)
content_items = create_layout_object(paths=paths, values=values)
Expand Down Expand Up @@ -96,9 +80,8 @@ def test_IsValidTypeValidator_obtain_invalid_content_items_success():
"detailsV2.tabs[1].sections[3].type",
"detailsV2.tabs[4].type",
"detailsV2.tabs[5].type",
"detailsV2.tabs[6].type",
],
values=["dynamic", "dynamic", "dynamic", "dynamic", "dynamic"],
values=["dynamic", "dynamic", "dynamic", "dynamic"],
)
assert not IsValidTypeValidator().obtain_invalid_content_items(
[valid_layout_object]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"todoTasks",
]

INVALID_TABS: List = ["canvas", "evidenceBoard", "relatedIncidents"]
INVALID_TABS: List = ["evidenceBoard", "relatedIncidents"]


class IsValidTypeValidator(BaseValidator[ContentTypes]):
Expand Down

0 comments on commit ebbc2f4

Please sign in to comment.