Skip to content

Commit

Permalink
pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
anas-yousef committed Apr 9, 2024
1 parent e0ac2b6 commit 4cb43db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions demisto_sdk/scripts/validate_content_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,11 @@ class InvalidIntegrationScriptMarkdownFileName(InvalidPathException):
"This file's name must either be (parent folder)_description.md, or README.md"
)


class InvalidXSIAMReportFileName(InvalidPathException):
message = "Name of XSIAM report files must have a prefix equal to the pack's name, e.g. `myPack_report1.yml`"


class InvalidSuffix(InvalidPathException):
message = "This file's suffix is not allowed."

Expand Down
8 changes: 5 additions & 3 deletions demisto_sdk/tests/validate_content_path_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,39 @@
DEPTH_ONE_FOLDERS,
DEPTH_ONE_FOLDERS_ALLOWED_TO_CONTAIN_FILES,
DIRS_ALLOWING_SPACE_IN_FILENAMES,
XSIAM_REPORTS_DIR,
ZERO_DEPTH_FILES,
InvalidClassifier,
InvalidDepthOneFile,
InvalidDepthOneFolder,
InvalidDepthZeroFile,
InvalidIntegrationScriptFileName,
InvalidIntegrationScriptFileType,
InvalidXSIAMReportFileName,
InvalidLayoutFileName,
InvalidSuffix,
InvalidXSIAMReportFileName,
PathIsFolder,
PathIsTestOrDocData,
PathIsUnified,
PathUnderDeprecatedContent,
SpacesInFileName,
XSIAM_REPORTS_DIR,
_validate,
)


def test_xsiam_report_file_valid():
pack_name = "myPack"
pack_path = Path("content", "Packs", pack_name)
_validate(pack_path / XSIAM_REPORTS_DIR / f"{pack_name}_Report.json")


def test_xsiam_report_file_invalid():
pack_name = "myPrivatePack"
wrong_prefix = "wrongPrefix"
pack_path = Path("content", "Packs", pack_name)
with pytest.raises(InvalidXSIAMReportFileName):
_validate(pack_path / XSIAM_REPORTS_DIR / f"{wrong_prefix}_Report.json")



def test_content_entities_dir_length():
"""
Expand All @@ -73,6 +74,7 @@ def test_content_entities_dir_length():

DUMMY_PACK_PATH = Path("content", "Packs", "myPack")


@pytest.mark.parametrize("file_name", ZERO_DEPTH_FILES)
def test_depth_zero_pass(file_name: str):
"""
Expand Down

0 comments on commit 4cb43db

Please sign in to comment.