def test_get_vnf_package_vnfd_with_tosca_meta_file_in_csar(self):
     fake_csar = fakes.create_fake_csar_dir(self.vnf_package.id)
     expected_data = fakes.get_expected_vnfd_data()
     result = self.conductor.get_vnf_package_vnfd(self.context,
                                                  self.vnf_package)
     self.assertEqual(expected_data, result)
     shutil.rmtree(fake_csar)
 def test_get_vnf_package_vnfd_exception_from_read_vnfd_files(
         self, mock_read_vnfd_files):
     fake_csar = fakes.create_fake_csar_dir(self.vnf_package.id)
     mock_read_vnfd_files.side_effect = yaml.YAMLError
     self.assertRaises(exceptions.FailedToGetVnfdData,
                       self.conductor.get_vnf_package_vnfd, self.context,
                       self.vnf_package)
     shutil.rmtree(fake_csar)
 def test_get_vnf_package_vnfd_with_single_yaml_csar(self):
     fake_csar = fakes.create_fake_csar_dir(self.vnf_package.id,
                                            single_yaml_csar=True)
     result = self.conductor.get_vnf_package_vnfd(self.context,
                                                  self.vnf_package)
     # only one key present in the result shows that it contains only one
     # yaml file
     self.assertEqual(1, len(result.keys()))
     shutil.rmtree(fake_csar)