Skip to content

Commit

Permalink
Fixed test_constants in the wrong directory (#35)
Browse files Browse the repository at this point in the history
* moved test_constants to proper directory
moved common constants from test_constants to constants
fixed some things in interation according to #4990 in content

* swap string format
  • Loading branch information
jochman authored Dec 1, 2019
1 parent 2d595b6 commit 87bfbd6
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 25 deletions.
18 changes: 17 additions & 1 deletion demisto_sdk/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def wrong_path(filepath):

@staticmethod
def wrong_version(file_path, expected="-1"):
return "{}: The version for our files should always be {}, please update the file.".format(expected, file_path)
return "{}: The version for our files should always be {}, please update the file.".format(file_path, expected)

@staticmethod
def wrong_version_reputations(file_path, object_id, version):
Expand Down Expand Up @@ -673,3 +673,19 @@ class PB_Status:
ACCEPTED_FILE_EXTENSIONS = [
'.yml', '.json', '.md', '.py', '.js', '.ps1', '.png', '', '.lock'
]

BANG_COMMAND_NAMES = {'file', 'email', 'domain', 'url', 'ip'}

DBOT_SCORES_DICT = {
'DBotScore.Indicator': 'The indicator that was tested.',
'DBotScore.Type': 'The indicator type.',
'DBotScore.Vendor': 'The vendor used to calculate the score.',
'DBotScore.Score': 'The actual score.'
}

IOC_OUTPUTS_DICT = {
'domain': {'Domain.Name'},
'file': {'File.MD5', 'File.SHA1', 'File.SHA256'},
'ip': {'IP.Address'},
'url': {'URL.Data'}
}
3 changes: 0 additions & 3 deletions demisto_sdk/common/hook_validations/base_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ def is_there_release_notes(self):
Returns:
(bool): is there release notes
"""
if self.old_file:
print_error(Errors.might_need_release_notes(self.file_path))
return True
if os.path.isfile(self.file_path):
rn_path = get_release_notes_file_path(self.file_path)
release_notes = get_latest_release_notes_text(rn_path)
Expand Down
7 changes: 3 additions & 4 deletions demisto_sdk/common/hook_validations/integration.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from demisto_sdk.common.constants import Errors, INTEGRATION_CATEGORIES, PYTHON_SUBTYPES
from demisto_sdk.common.constants import Errors, INTEGRATION_CATEGORIES, PYTHON_SUBTYPES, BANG_COMMAND_NAMES, \
DBOT_SCORES_DICT, IOC_OUTPUTS_DICT
from demisto_sdk.common.hook_validations.base_validator import BaseValidator
from demisto_sdk.common.hook_validations.tests_constants import BANG_COMMAND_NAMES, DBOT_SCORES_DICT, \
IOC_OUTPUTS_DICT
from demisto_sdk.common.tools import print_error, print_warning, get_dockerimage45, server_version_compare


Expand Down Expand Up @@ -343,7 +342,7 @@ def is_changed_command_name_or_arg(self):
def _is_sub_set(supposed_bigger_list, supposed_smaller_list):
# type: (list, list) -> bool
"""Check if supposed_smaller_list is a subset of the supposed_bigger_list"""
return all([item in supposed_bigger_list for item in supposed_smaller_list])
return all(item in supposed_bigger_list for item in supposed_smaller_list)

def _get_command_to_context_paths(self, integration_json):
# type: (dict) -> dict
Expand Down
2 changes: 1 addition & 1 deletion tests/structure_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from demisto_sdk.common.constants import DIR_LIST
from demisto_sdk.common.hook_validations.structure import StructureValidator
from demisto_sdk.common.hook_validations.tests_constants import VALID_TEST_PLAYBOOK_PATH, INVALID_PLAYBOOK_PATH, \
from tests.tests_constants import VALID_TEST_PLAYBOOK_PATH, INVALID_PLAYBOOK_PATH, \
VALID_INTEGRATION_TEST_PATH, VALID_INTEGRATION_ID_PATH, INVALID_INTEGRATION_ID_PATH, VALID_PLAYBOOK_ID_PATH, \
INVALID_PLAYBOOK_ID_PATH, VALID_REPUTATION_PATH, VALID_LAYOUT_PATH, INVALID_LAYOUT_PATH, INVALID_WIDGET_PATH, \
VALID_WIDGET_PATH, VALID_DASHBOARD_PATH, INVALID_DASHBOARD_PATH, INVALID_REPUTATION_PATH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
"weeks": 0,
"weeksR": 0,
"fromVersion": "5.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,3 @@
INVALID_WIDGET_VERSION_PATH = "./tests/test_files/widget-invalid-version.json"
VALID_SCRIPT_PATH = "./tests/test_files/script-valid.yml"
INVALID_SCRIPT_PATH = "./tests/test_files/script-invalid.yml"
BANG_COMMAND_NAMES = {'file', 'email', 'domain', 'url', 'ip'}
DBOT_SCORES_DICT = {
'DBotScore.Indicator': 'The indicator that was tested.',
'DBotScore.Type': 'The indicator type.',
'DBotScore.Vendor': 'The vendor used to calculate the score.',
'DBotScore.Score': 'The actual score.'
}

IOC_OUTPUTS_DICT = {
'domain': {'Domain.Name'},
'file': {'File.MD5', 'File.SHA1', 'File.SHA256'},
'ip': {'IP.Address'},
'url': {'URL.Data'}
}
2 changes: 1 addition & 1 deletion tests/validators_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from demisto_sdk.common.hook_validations.reputation import ReputationValidator
from demisto_sdk.common.hook_validations.script import ScriptValidator
from demisto_sdk.common.hook_validations.structure import StructureValidator
from demisto_sdk.common.hook_validations.tests_constants import VALID_LAYOUT_PATH, INVALID_LAYOUT_PATH, \
from tests.tests_constants import VALID_LAYOUT_PATH, INVALID_LAYOUT_PATH, \
VALID_REPUTATION_PATH, INVALID_REPUTATION_PATH, VALID_WIDGET_PATH, INVALID_WIDGET_PATH, VALID_DASHBOARD_PATH, \
VALID_SCRIPT_PATH, INVALID_SCRIPT_PATH, INVALID_DASHBOARD_PATH, VALID_INCIDENT_FIELD_PATH, \
INVALID_INCIDENT_FIELD_PATH
Expand Down

0 comments on commit 87bfbd6

Please sign in to comment.