def test_save_to_file(self): metadata = Metadata() metadata.set_property('version', 'v0.1') metadata.set_property('summary', {'title': 'test_title'}) metadata.save_to_path('test-save-to-file.yaml') metadata = Metadata() metadata.load_from_path('test-save-to-file.yaml') self.assertEqual(metadata['version'], 'v0.1') self.assertEqual(metadata['summary']['title'], 'test_title') os.unlink('test-save-to-file.yaml')
def test_load_from_path_invalid(self): metadata = Metadata() with self.assertRaises(FileNotFoundError): metadata.load_from_path('test-metadata-nope.yaml')
def test_load_from_path(self): metadata = Metadata() metadata.load_from_path('test-metadata.yaml') self.assertEqual(metadata["summary"]["title"], "test_title") self.assertEqual(metadata["manifests"][0]["path"], "test.txt")