def test_update_armada_manifest_keys_not_removed_with_override(self): with open(self.base_manifest) as f: documents = list(yaml.safe_load_all(f.read())) documents_modified = copy.deepcopy(documents) del documents_modified[2]['data']['release_prefix'] # verify both doc have different values for data self.assertNotEqual(documents[2], documents_modified[2]) ovr = Override(documents) # update with document values from base_manifest ovr.update_armada_manifest(documents_modified[2]) self.assertIn('release_prefix', ovr.documents[2]['data']) self.assertNotEqual(ovr.documents[2], documents_modified[2])
def test_update_armada_manifest_valid(self): with open(self.base_manifest) as f: documents = list(yaml.safe_load_all(f.read())) documents_modified = copy.deepcopy(documents) documents_modified[2]['data']['release_prefix'] = 'armada-modified' # starting out, both doc have different values for data self.assertNotEqual(documents[2], documents_modified[2]) ovr = Override(documents) # update with document values with the modified ones ovr.update_armada_manifest(documents_modified[2]) # after the update, both documents are equal self.assertEqual(ovr.documents[2]['data']['release_prefix'], documents_modified[2]['data']['release_prefix']) self.assertEqual(ovr.documents[2], documents_modified[2])