diff --git a/tests/unit/test_global_config_validator.py b/tests/unit/test_global_config_validator.py index fd365a374..43dc3b9f2 100644 --- a/tests/unit/test_global_config_validator.py +++ b/tests/unit/test_global_config_validator.py @@ -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() diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 33a97831f..aa4e97c42 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -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 diff --git a/tests/unit/testdata/valid_config_with_input_status_confirmation.json b/tests/unit/testdata/valid_config_with_input_status_confirmation.json new file mode 100644 index 000000000..d8189ca5f --- /dev/null +++ b/tests/unit/testdata/valid_config_with_input_status_confirmation.json @@ -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" + } +}