def test_encoding_validator(self): directory_to_test = "workflow_examples/encoding_tests" file_to_test = "workflow_bad_encoding.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [WorkflowEncodingValidator()]) self.assertEqual(result, 1) file_to_test = "workflow_good_encoding.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [WorkflowEncodingValidator()]) self.assertEqual(result, 0)
def test_description_validator(self): # Test bad workflows. This will test the workflow_description_validator directory_to_test = "workflow_examples/description_tests" file_to_test = "workflow_no_description.spec.yaml" result = validate( directory_to_test, file_to_test, False, True, [WorkflowDescriptionValidator()], ) self.assertTrue(result) file_to_test = "workflow_no_period.spec.yaml" result = validate( directory_to_test, file_to_test, False, True, [WorkflowDescriptionValidator()], ) self.assertTrue(result) file_to_test = "workflow_whitespace.spec.yaml" result = validate( directory_to_test, file_to_test, False, True, [WorkflowDescriptionValidator()], ) self.assertTrue(result) file_to_test = "workflow_blank_description.spec.yaml" result = validate( directory_to_test, file_to_test, False, True, [WorkflowDescriptionValidator()], ) self.assertTrue(result) file_to_test = "workflow_lower_case.spec.yaml" result = validate( directory_to_test, file_to_test, False, True, [WorkflowDescriptionValidator()], ) self.assertTrue(result)
def test_name_validator(self): # Test bad workflows. This will test the workflow_icon_filename_validator directory_to_test = "workflow_examples/name_tests" file_to_test = "workflow_bad_name.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [WorkflowNameValidator()]) self.assertTrue(result)
def test_help_validator_help_headers_not_found_should_fail(self): # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/bad_plugin_headings_not_found_in_help" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [HelpValidator()]) self.assertEqual(result, 1)
def test_change_log_validator(self): # Test bad workflows. This will test the workflow_change_log_validator directory_to_test = "workflow_examples/change_log_tests" file_to_test = "workflow.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [WorkflowChangelogValidator()]) self.assertTrue(result)
def test_plugin_with_false_for_required_on_output(self): # TODO This validator is not correctly made: fix # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/bad_plugin_no_required_key_in_output" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True) self.assertEqual(result, 1)
def test_array_in_help(self): # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/good_plugin" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [HelpInputOutputValidator()]) self.assertEqual(result, 0, "Result should be success")
def test_encoding_validator_should_success(self): # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/encoding_tests" file_to_test = "plugin_good_encoding.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [EncodingValidator()]) self.assertEqual(result, 0)
def test_support_validator(self): # Test bad workflows. This will test the workflow_support_validator directory_to_test = "workflow_examples/support_tests" file_to_test = "workflow_no_supporter.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [WorkflowSupportValidator()]) self.assertTrue(result)
def test_example_input_validator_should_fail_when_not_all_exists(self): # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/bad_plugin_array_in_help" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [ExampleInputValidator()]) self.assertEqual(result, 1)
def test_confidential_validator_validate_email_should_success(self): # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/good_plugin_validate_email" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [ConfidentialValidator()]) self.assertEqual(result, 0)
def test_profanity_validator(self): # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/profanity_tests" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [ProfanityValidator()]) self.assertEqual(result, 1)
def test_help_example_json_fail(self): # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/bad_plugin_help_example_wrong_json" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [HelpExampleValidator()]) self.assertEqual(result, 1)
def test_title_validator_with_number_in_title(self): # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/plugin_number_title" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [TitleValidator()]) self.assertEqual(result, 0)
def test_unapproved_keywords_validator_should_print_warning(self): # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/good_plugin_warning_keywords" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [UnapprovedKeywordsValidator()]) self.assertEqual(result, 0)
def test_help_example_spaces_and_json_should_success(self): # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/good_plugin" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [HelpExampleValidator()]) self.assertEqual(result, 0)
def test_acronym_validator_should_success(self): # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/good_plugin" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [AcronymValidator()]) self.assertEqual(result, 0)
def test_acronym_validator_lower_acronym_plugin_spec_should_fail(self): # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/acronym_validator_spec_bad" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [AcronymValidator()]) self.assertEqual(result, 1)
def test_version_validator(self): # Test bad workflows. This will test the workflow_version_validator directory_to_test = "workflow_examples/version_tests" file_to_test = "workflow_version_too_low.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [WorkflowVersionValidator()]) self.assertTrue(result)
def test_cloud_ready_validator_system_command_should_fail(self): # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/bad_plugin_cloud_ready_system_command" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [CloudReadyValidator()]) self.assertEqual(result, 1)
def test_supported_version_validator(self): # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/supported_version_validator" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [SupportedVersionValidator()]) self.assertEqual(result, 0)
def test_png_hash_validator(self): # Test bad workflows. This will test the workflow_png_hash_validator directory_to_test = "workflow_examples/png_hash_tests" file_to_test = "workflow.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [WorkflowPNGHashValidator()]) self.assertTrue(result)
def test_use_case_validator_keywords_from_use_case_list_should_fail(self): # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/bad_plugin_keywords_from_use_case_list_in_spec" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [UseCaseValidator()]) self.assertEqual(result, 1)
def test_cloud_ready_connection_credential_token_validator_should_fail( self): directory_to_test = "plugin_examples/cloud_ready_connection_credential_token_validator" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [CloudReadyConnectionCredentialTokenValidator()]) self.assertEqual(result, 1)
def test_description_validator_validate_existed_description_should_fail( self): # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/bad_plugin_no_description" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [DescriptionValidator()]) self.assertEqual(result, 1)
def test_title_validator_validator_capitalized_word_where_should_not_should_fail( self): # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/bad_plugin_no_example_in_spec" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [TitleValidator()]) self.assertEqual(result, 1)
def test_example_input_validator_should_success_when_example_are_0_false( self): # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/good_plugin_example_in_spec_0_false" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [ExampleInputValidator()]) self.assertEqual(result, 0)
def test_use_case_validator_keywords_from_use_case_list_should_fail(self): directory_to_test = ( "workflow_examples/description_validator_keywords_from_use_case_list_bad" ) file_to_test = "workflow.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [UseCaseValidator()]) self.assertEqual(result, 1)
def test_version_pin_validator_should_fail_when_no_version_pin(self): self.replace_requirements( "plugin_examples/version_pin_validator/requirements.txt", "ldap3") # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/version_pin_validator" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [VersionPinValidator()]) self.assertEqual(result, 1)
def test_bad_array_in_help(self): # example workflow in plugin_examples directory. Run tests with these files directory_to_test = "plugin_examples/bad_plugin_array_in_help" file_to_test = "plugin.spec.yaml" result = validate(directory_to_test, file_to_test, False, True, [HelpInputOutputValidator()]) # TODO this clear violations for other tests HelpInputOutputValidator.violations = [] HelpInputOutputValidator.violated = 0 self.assertEqual(result, 1, "Result should be failed")