def test_validate_tf_schema_good(terraform_schema): tf_schema_file = terraform_schema tf_complete_config = os.path.join(os.path.dirname(__file__), os.pardir, 'test_data', 'terraform_complete_data.json') tf_config = utils.load_vars(tf_complete_config) utils.validate_schema(tf_config, tf_schema_file)
def test_validate_schema_good(basic_schema): basic_schema_file = basic_schema basic_complete_config = os.path.join(os.path.dirname(__file__), os.pardir, 'test_data', 'base_complete_config.json') basic_config = utils.load_vars(basic_complete_config) utils.validate_schema(basic_config, basic_schema_file)
def test_validate_tf_schema_missing_required_property(terraform_schema): tf_schema_file = terraform_schema with pytest.raises(ValidationError) as e: tf_incomplete_config = os.path.join(os.path.dirname(__file__), os.pardir, 'test_data', 'terraform_incomplete_data.json') tf_config = utils.load_vars(tf_incomplete_config) utils.validate_schema(tf_config, tf_schema_file) assert e.value.message == "u'public_zone_id' is a required property"
def test_validate_schema_missing_required_property(basic_schema): basic_schema_file = basic_schema with pytest.raises(ValidationError) as e: basic_incomplete_config = os.path.join(os.path.dirname(__file__), os.pardir, 'test_data', 'base_incomplete_config.json') basic_config = utils.load_vars(basic_incomplete_config) utils.validate_schema(basic_config, basic_schema_file) assert e.value.message == "u'aws_profile' is a required property"
def test_load_vars(setup_teardown): loaded_data = utils.load_vars(setup_teardown['filename']) assert loaded_data == setup_teardown['mock_config']