Ejemplo n.º 1
0
 def test_missing_ovf_env_xml_raises_non_azure_datasource_error(self):
     """load_azure_ds_dir raises an error When ovf-env.xml doesn't exit."""
     with self.assertRaises(dsaz.NonAzureDataSource) as context_manager:
         dsaz.load_azure_ds_dir(self.source_dir)
     self.assertEqual(
         'No ovf-env file found',
         str(context_manager.exception))
Ejemplo n.º 2
0
 def test_wb_invalid_ovf_env_xml_calls_read_azure_ovf(self):
     """load_azure_ds_dir calls read_azure_ovf to parse the xml."""
     ovf_path = os.path.join(self.source_dir, 'ovf-env.xml')
     with open(ovf_path, 'wb') as stream:
         stream.write(b'invalid xml')
     with self.assertRaises(dsaz.BrokenAzureDataSource) as context_manager:
         dsaz.load_azure_ds_dir(self.source_dir)
     self.assertEqual('Invalid ovf-env.xml: syntax error: line 1, column 0',
                      str(context_manager.exception))