Mercurial > python-hglib
diff tests/test-phase.py @ 125:8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
author | Paul Tonelli <paul.tonelli@logilab.fr> |
---|---|
date | Fri, 16 May 2014 18:21:12 +0200 |
parents | |
children | a7fe976b1931 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-phase.py Fri May 16 18:21:12 2014 +0200 @@ -0,0 +1,40 @@ +import common, hglib + +class test_phase(common.basetest): + """test the different ways to use the phase command""" + def test_phase(self): + """test getting data from a single changeset""" + self.append('a', 'a') + rev, node0 = self.client.commit('first', addremove=True) + self.assertEqual([(0, 'draft')], self.client.phase(node0)) + + def test_phase_public(self): + """phase change from draft to public""" + self.append('a', 'a') + rev, node0 = self.client.commit('first', addremove=True) + self.client.phase(node0, public=True) + self.assertEqual([(0, 'public')], self.client.phase(node0)) + + def test_phase_secret(self): + """phase change from draft to secret""" + self.append('a', 'a') + rev, node0 = self.client.commit('first', addremove=True) + with self.assertRaises(hglib.error.CommandError): + self.client.phase(node0, secret=True) + self.client.phase(node0, secret=True, force=True) + self.assertEqual([(0, 'secret')], self.client.phase(node0)) + + def test_phase_multiple(self): + """phase changes and show the phases of the different changesets""" + self.append('a', 'a') + rev, node0 = self.client.commit('a', addremove=True) + self.client.phase(node0, public=True) + self.append('b', 'b') + rev, node1 = self.client.commit('b', addremove=True) + self.append('c', 'c') + rev, node2 = self.client.commit('c', addremove=True) + self.client.phase(node2, secret=True, force=True) + self.assertEqual([(0, 'public'), (2, 'secret'), (1, 'draft')], + self.client.phase([node0,node2,node1])) + +