UT: Add Windows tests for CustomPBAConfiguration filename validation

This commit is contained in:
Shreya Malviya 2022-07-26 17:28:40 +05:30
parent 5b9ba9cd27
commit e7d9ed88be
1 changed files with 15 additions and 5 deletions

View File

@ -69,25 +69,35 @@ def test_custom_pba_configuration_schema():
assert config.windows_filename == WINDOWS_FILENAME
def test_custom_pba_configuration_schema__empty_filename_allowed():
def test_custom_pba_configuration_schema__empty_filenames_allowed():
schema = CustomPBAConfigurationSchema()
empty_filename_configuration = CUSTOM_PBA_CONFIGURATION.copy()
empty_filename_configuration.update({"linux_filename": ""})
empty_filename_configuration.update({"linux_filename": "", "windows_filename": ""})
config = schema.load(empty_filename_configuration)
assert config.linux_command == LINUX_COMMAND
assert config.linux_filename == ""
assert config.windows_command == WINDOWS_COMMAND
assert config.windows_filename == WINDOWS_FILENAME
assert config.windows_filename == ""
def test_custom_pba_configuration_schema__invalid_filename():
def test_custom_pba_configuration_schema__invalid_linux_filename():
schema = CustomPBAConfigurationSchema()
invalid_filename_configuration = CUSTOM_PBA_CONFIGURATION.copy()
invalid_filename_configuration["linux_filename"] = "???"
invalid_filename_configuration["linux_filename"] = "\\"
with pytest.raises(ValidationError):
schema.load(invalid_filename_configuration)
def test_custom_pba_configuration_schema__invalid_windows_filename():
schema = CustomPBAConfigurationSchema()
invalid_filename_configuration = CUSTOM_PBA_CONFIGURATION.copy()
invalid_filename_configuration["windows_filename"] = "?"
with pytest.raises(ValidationError):
schema.load(invalid_filename_configuration)