diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2013-09-20 14:38:26 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2013-09-24 10:26:03 +0000 |
commit | e664f2000e233c1f05657e7e2dd85e8a182deb0e (patch) | |
tree | e3ae31c3282124188f1c81e3a7d50b1b7360c6a3 /morphlib/morphset_tests.py | |
parent | 924e2192ae3de5974ee058c0ea9c180f2e46d78e (diff) | |
download | morph-e664f2000e233c1f05657e7e2dd85e8a182deb0e.tar.gz |
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.
Diffstat (limited to 'morphlib/morphset_tests.py')
-rw-r--r-- | morphlib/morphset_tests.py | 17 |
1 files changed, 17 insertions, 0 deletions
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', + } + ]) + |