Skip to content

Commit

Permalink
Merge branch 'develop' into wider-packaging-version
Browse files Browse the repository at this point in the history
  • Loading branch information
artemrys authored Nov 26, 2024
2 parents 4e93cf1 + 282e2ef commit 339c476
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/unit/test_global_config_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,3 +579,15 @@ def test_should_warn_on_empty_validators(schema_json):
field["validators"] = [number_validator]

assert not should_warn_on_empty_validators(oauth_entity)


def test_config_validation_status_toggle_confirmation():
global_config_path = helpers.get_testdata_file_path(
"valid_config_with_input_status_confirmation.json"
)
global_config = global_config_lib.GlobalConfig(global_config_path)

validator = GlobalConfigValidator(helpers.get_path_to_source_dir(), global_config)

with does_not_raise():
validator.validate()
14 changes: 14 additions & 0 deletions tests/unit/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,17 @@ def test_dump_yaml_config(tmp_path):
content = f.read()

assert expected_content == content


@pytest.mark.parametrize(
"test_path,expected_path",
[
("/home/john/Test/test.txt", "home/john/Test/test.txt"),
("\\home\\john\\Test\\test.txt", "home/john/Test/test.txt"),
("\\\\home\\\\john\\\\Test\\\\test.txt", "home/john/Test/test.txt"),
],
)
def test_get_os_path(test_path, expected_path):
stripped_path = utils.get_os_path(test_path)

assert stripped_path == expected_path
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"pages": {
"configuration": {
"tabs": [
{
"name": "account",
"table": {
"actions": ["edit", "delete", "clone"],
"header": [
{
"label": "Name",
"field": "name"
}
]
},
"entity": [
{
"type": "text",
"label": "Name",
"validators": [
{
"type": "string",
"errorMsg": "Length of ID should be between 1 and 50",
"minLength": 1,
"maxLength": 50
},
{
"type": "regex",
"errorMsg": "Name must begin with a letter and consist exclusively of alphanumeric characters and underscores.",
"pattern": "^[a-zA-Z]\\w*$"
}
],
"field": "name",
"help": "Enter a unique name for this account.",
"required": true
}
],
"title": "Account"
}
],
"title": "Configuration",
"description": "Set up your add-on"
},
"inputs": {
"title": "Status toggle confirmation test",
"services": [
{
"name": "example_input_one",
"title": "Input one status toggle confirmation test",
"entity": [
{
"type": "text",
"label": "Name",
"field": "name"
}
]
},
{
"name": "example_input_two",
"title": "Input two status toggle confirmation test",
"entity": [
{
"type": "text",
"label": "Name",
"field": "name"
}
]
}
],
"table": {
"actions": ["edit", "delete", "clone"],
"header": [
{
"label": "Name",
"field": "name"
}
]
},
"useInputToggleConfirmation": true
}
},
"meta": {
"name": "Splunk_TA_UCCExample",
"restRoot": "splunk_ta_uccexample",
"version": "5.39.0Ra9e840a6",
"displayName": "Splunk UCC test Add-on",
"schemaVersion": "0.0.3",
"_uccVersion": "5.39.0"
}
}

0 comments on commit 339c476

Please sign in to comment.