def _preflight(self, data): env = os.environ.copy() env = set_env_from_file(env, self.env_file) errors = schema_v2.pre_validate(data, env, MOLECULE_KEEP_STRING) if errors: msg = "Failed to validate.\n\n{}".format(errors) util.sysexit_with_message(msg)
def test_has_errors_when_molecule_env_var_referenced_in_unallowed_sections( _model_molecule_env_errors_section_data, _env, _keep_string): x = { 'scenario': [{ 'name': ['cannot reference $MOLECULE special variables in this section'] }], 'lint': [{ 'name': [ 'cannot reference $MOLECULE special variables in this section', 'unallowed value $MOLECULE_LINT_NAME', ] }], 'driver': [{ 'name': [ 'cannot reference $MOLECULE special variables in this section', 'unallowed value $MOLECULE_DRIVER_NAME', ] }], 'dependency': [{ 'name': [ 'cannot reference $MOLECULE special variables in this section', 'unallowed value $MOLECULE_DEPENDENCY_NAME', ] }], 'verifier': [{ 'lint': [{ 'name': [ ('cannot reference $MOLECULE special variables in this ' 'section'), 'unallowed value $MOLECULE_VERIFIER_LINT_NAME', ] }], 'name': [ 'cannot reference $MOLECULE special variables in this section', 'unallowed value $MOLECULE_VERIFIER_NAME', ], }], 'provisioner': [{ 'lint': [{ 'name': [ ('cannot reference $MOLECULE special variables in this ' 'section'), 'unallowed value $MOLECULE_PROVISIONER_LINT_NAME', ] }], 'name': [ 'cannot reference $MOLECULE special variables in this section', 'unallowed value $MOLECULE_PROVISIONER_NAME', ], }], } assert x == schema_v2.pre_validate(_model_molecule_env_errors_section_data, _env, _keep_string)
def test_platforms_docker_has_errors(_stream, _env, _keep_string): x = { 'platforms': [{ 0: [{ 'registry': [{ 'credentials': [{ 'password': ['must be of string type'] }] }] }] }] } assert x == schema_v2.pre_validate(_stream(), _env, _keep_string)
def test_platforms_docker_has_errors(_stream): x = { 'platforms': [{ 0: [{ 'registry': [{ 'credentials': [{ 'password': [ ('value does not match regex ' "'^[{$]+[a-z0-9A-Z]+[}]*$'"), ] }] }] }] }] } assert x == schema_v2.pre_validate(_stream())
def test_has_errors_when_molecule_env_var_referenced_in_unallowed_sections( _stream): x = { 'scenario': [{ 'name': ['cannot reference $MOLECULE special variables in this section'] }], 'lint': [{ 'name': ['cannot reference $MOLECULE special variables in this section'] }], 'driver': [{ 'name': ['cannot reference $MOLECULE special variables in this section'] }], 'dependency': [{ 'name': ['cannot reference $MOLECULE special variables in this section'] }], 'verifier': [{ 'lint': [{ 'name': [('cannot reference $MOLECULE special variables in this ' 'section')] }], 'name': ['cannot reference $MOLECULE special variables in this section'] }], 'provisioner': [{ 'lint': [{ 'name': [('cannot reference $MOLECULE special variables in this ' 'section')] }], 'name': ['cannot reference $MOLECULE special variables in this section'] }], } assert x == schema_v2.pre_validate(_stream())
def test_platforms_docker(_stream): assert {} == schema_v2.pre_validate(_stream())
def test_platforms_docker(_model_platforms_docker_section_data, _env, _keep_string): assert {} == schema_v2.pre_validate(_model_platforms_docker_section_data, _env, _keep_string)
def _preflight(self, data): errors = schema_v2.pre_validate(data) if errors: msg = "Failed to validate.\n\n{}".format(errors) util.sysexit_with_message(msg)
def test_platforms_docker(_stream, _env, _keep_string): assert {} == schema_v2.pre_validate(_stream(), _env, _keep_string)