def test_findsAll(self): (status, successful, failed, ignored) = validator.validate_cwd('', schema, build_map) self.assertEqual(status, 1) self.assertSetEqual(successful, {Path('CAPS.VERSION')}) self.assertSetEqual(failed, {Path('camelCaseVersionMissing.Version')}) # Make sure 'not-detected.version.json' has not been detected. self.assertSetEqual(ignored, set())
def validate_current_repository(): debug = str_to_bool(os.getenv('INPUT_DEBUG', 'false')) setup_logger(debug) exclude = os.getenv('INPUT_EXCLUDE', '') (status, successful, failed, ignored) = validate_cwd(exclude) print(f'Exiting with status {status}: {len(successful)} successful, {len(failed)} failed, {len(ignored)} ignored.') exit(status)
def test_recursiveExclusion(self): (status, successful, failed, ignored) = validator.validate_cwd('["./recursiveness/**/*"]', schema, build_map) self.assertEqual(status, 1) self.assertSetEqual(successful, {Path('default.version')}) self.assertSetEqual( ignored, { Path('recursiveness/recursive.version'), Path('recursiveness/recursiveness2/recursive2.version') }) self.assertEqual(failed, {Path('failing/failing-validation.version')})
def test_exclusionWildcard(self): (status, successful, failed, ignored) = validator.validate_cwd('failing/*.version', schema, build_map) self.assertEqual(status, 0) self.assertSetEqual( successful, { Path('default.version'), Path('recursiveness/recursive.version'), Path('recursiveness/recursiveness2/recursive2.version') }) self.assertSetEqual(ignored, {Path('failing/failing-validation.version')}) self.assertEqual(failed, set())
def test_invalidWorkspace_recursive(self): (status, successful, failed, ignored) = validator.validate_cwd('', schema, build_map) self.assertEqual(status, 1)
def test_doubleQuotation(self): (status, successful, failed, ignored) = validator.validate_cwd( '"failing/failing-validation.version"', schema, build_map) self.assertEqual(status, 0)
def test_validRemote_cwd(self): (status, successful, failed, ignored) = validator.validate_cwd('', schema, build_map) self.assertIn(Path('valid-remote.version'), successful)