From e664f2000e233c1f05657e7e2dd85e8a182deb0e Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 20 Sep 2013 14:38:26 +0000 Subject: MorphSet: Add petrify_chunks() method petrify_chunks handles regular petrification and branch_from_image's petrifying to another point in time. It is given the values to petrify to, instead of doing the ref resolution itself, since now it will consistently resolve refs to the same thing, and a different resolution can be passed in to petrify to another point in time. It only petrifies chunks, since petrifying strata and systems is a more complex operation that is not currently handled anyway. --- morphlib/morphset_tests.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'morphlib/morphset_tests.py') diff --git a/morphlib/morphset_tests.py b/morphlib/morphset_tests.py index 24f3d91a..baa3e103 100644 --- a/morphlib/morphset_tests.py +++ b/morphlib/morphset_tests.py @@ -191,3 +191,20 @@ class MorphologySetTests(unittest.TestCase): self.assertEqual(sorted(self.morphs.list_refs()), [('test:foo-chunk', 'master'), ('test:morphs', 'master')]) + + def test_petrify_chunks(self): + # TODO: test petrifying a larger morphset + self.morphs.add_morphology(self.system) + self.morphs.add_morphology(self.stratum) + self.morphs.petrify_chunks({('test:foo-chunk', 'master'): '0'*40}) + self.assertEqual( + self.stratum['chunks'], + [ + { + 'repo': 'test:foo-chunk', + 'ref': '0'*40, + 'morph': 'foo-chunk', + 'unpetrify-ref': 'master', + } + ]) + -- cgit v1.2.1