def test_validateconfig_file_error_on_invalid_header(self): """On invalid header, validate_cloudconfig_file errors. A SchemaValidationError is raised when the file doesn't begin with CLOUD_CONFIG_HEADER. """ write_file(self.config_file, '#junk') with self.assertRaises(SchemaValidationError) as context_mgr: validate_cloudconfig_file(self.config_file, {}) self.assertEqual( 'Cloud config schema errors: header: File {0} needs to begin with ' '"{1}"'.format(self.config_file, CLOUD_CONFIG_HEADER.decode()), str(context_mgr.exception))
def test_validateconfig_file_error_on_invalid_header(self): """On invalid header, validate_cloudconfig_file errors. A SchemaValidationError is raised when the file doesn't begin with CLOUD_CONFIG_HEADER. """ write_file(self.config_file, '#junk') with self.assertRaises(SchemaValidationError) as context_mgr: validate_cloudconfig_file(self.config_file, {}) self.assertEqual( 'Cloud config schema errors: format-l1.c1: File {0} needs to begin' ' with "{1}"'.format( self.config_file, CLOUD_CONFIG_HEADER.decode()), str(context_mgr.exception))