comparison tests/test-phase.py @ 126:a7fe976b1931

context: add 'phase' getter This method must be dynamic as the phase can change during the lifetime of the changeset.
author Paul Tonelli <paul.tonelli@logilab.fr>
date Wed, 21 May 2014 12:25:30 +0200
parents 8d9a9da3e7b4
children bcc8390d7819
comparison
equal deleted inserted replaced
125:8d9a9da3e7b4 126:a7fe976b1931
5 def test_phase(self): 5 def test_phase(self):
6 """test getting data from a single changeset""" 6 """test getting data from a single changeset"""
7 self.append('a', 'a') 7 self.append('a', 'a')
8 rev, node0 = self.client.commit('first', addremove=True) 8 rev, node0 = self.client.commit('first', addremove=True)
9 self.assertEqual([(0, 'draft')], self.client.phase(node0)) 9 self.assertEqual([(0, 'draft')], self.client.phase(node0))
10 ctx = self.client[rev]
11 self.assertEqual('draft', ctx.phase())
10 12
11 def test_phase_public(self): 13 def test_phase_public(self):
12 """phase change from draft to public""" 14 """test phase change from draft to public"""
13 self.append('a', 'a') 15 self.append('a', 'a')
14 rev, node0 = self.client.commit('first', addremove=True) 16 rev, node0 = self.client.commit('first', addremove=True)
15 self.client.phase(node0, public=True) 17 self.client.phase(node0, public=True)
16 self.assertEqual([(0, 'public')], self.client.phase(node0)) 18 self.assertEqual([(0, 'public')], self.client.phase(node0))
19 ctx = self.client[rev]
20 self.assertEqual('public', ctx.phase())
17 21
18 def test_phase_secret(self): 22 def test_phase_secret(self):
19 """phase change from draft to secret""" 23 """test phase change from draft to secret"""
20 self.append('a', 'a') 24 self.append('a', 'a')
21 rev, node0 = self.client.commit('first', addremove=True) 25 rev, node0 = self.client.commit('first', addremove=True)
22 with self.assertRaises(hglib.error.CommandError): 26 with self.assertRaises(hglib.error.CommandError):
23 self.client.phase(node0, secret=True) 27 self.client.phase(node0, secret=True)
24 self.client.phase(node0, secret=True, force=True) 28 self.client.phase(node0, secret=True, force=True)
25 self.assertEqual([(0, 'secret')], self.client.phase(node0)) 29 self.assertEqual([(0, 'secret')], self.client.phase(node0))
30 ctx = self.client[rev]
31 self.assertEqual('secret', ctx.phase())
32
26 33
27 def test_phase_multiple(self): 34 def test_phase_multiple(self):
28 """phase changes and show the phases of the different changesets""" 35 """test phase changes and show the phases of the different changesets"""
29 self.append('a', 'a') 36 self.append('a', 'a')
30 rev, node0 = self.client.commit('a', addremove=True) 37 rev, node0 = self.client.commit('a', addremove=True)
31 self.client.phase(node0, public=True) 38 self.client.phase(node0, public=True)
32 self.append('b', 'b') 39 self.append('b', 'b')
33 rev, node1 = self.client.commit('b', addremove=True) 40 rev, node1 = self.client.commit('b', addremove=True)