-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
514 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
changes: | ||
- description: added support in the new validation. For validators that run on all files and use the graph. | ||
type: internal | ||
pr_number: 4301 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
from demisto_sdk.commands.validate.validators.base_validator import BaseValidator | ||
from demisto_sdk.commands.validate.validators.GR_validators.GR104_is_pack_display_name_already_exists_all_files import ( | ||
IsPackDisplayNameAlreadyExistsValidatorAllFiles, | ||
) | ||
from demisto_sdk.commands.validate.validators.GR_validators.GR104_is_pack_display_name_already_exists_list_files import ( | ||
IsPackDisplayNameAlreadyExistsValidatorListFiles, | ||
) | ||
from TestSuite.repo import Repo | ||
|
||
|
||
def test_IsPackDisplayNameAlreadyExistsValidatorListFiles_is_valid(graph_repo: Repo): | ||
""" | ||
Given | ||
- 3 packs, and 2 of them are with the same name | ||
When | ||
- running IsPackDisplayNameAlreadyExistsValidatorListFiles is_valid function. | ||
Then | ||
- Validate that we got the error messages for the duplicate name. | ||
""" | ||
|
||
graph_repo.create_pack(name="pack1") | ||
|
||
graph_repo.create_pack(name="pack2") | ||
graph_repo.packs[1].pack_metadata.update( | ||
{ | ||
"name": "pack1", | ||
} | ||
) | ||
|
||
graph_repo.create_pack(name="pack3") | ||
|
||
BaseValidator.graph_interface = graph_repo.create_graph() | ||
|
||
results = IsPackDisplayNameAlreadyExistsValidatorListFiles().is_valid( | ||
[pack for pack in graph_repo.packs] | ||
) | ||
|
||
assert len(results) == 2 | ||
|
||
|
||
def test_IsPackDisplayNameAlreadyExistsValidatorAllFiles_is_valid(graph_repo: Repo): | ||
""" | ||
Given | ||
- 3 packs, and 2 of them are with the same name | ||
When | ||
- running IsPackDisplayNameAlreadyExistsValidatorAllFiles is_valid function. | ||
Then | ||
- Validate that we got the error messages for the duplicate name. | ||
""" | ||
|
||
graph_repo.create_pack(name="pack1") | ||
|
||
graph_repo.create_pack(name="pack2") | ||
graph_repo.packs[1].pack_metadata.update( | ||
{ | ||
"name": "pack1", | ||
} | ||
) | ||
|
||
graph_repo.create_pack(name="pack3") | ||
|
||
BaseValidator.graph_interface = graph_repo.create_graph() | ||
|
||
results = IsPackDisplayNameAlreadyExistsValidatorAllFiles().is_valid( | ||
[pack for pack in graph_repo.packs] | ||
) | ||
|
||
assert len(results) == 2 |
Oops, something went wrong.