annotate tests/test-phase.py @ 143:4359cabcb0cc

hglib: move string literals in the test code to util.b() (issue4520)
author Brett Cannon <brett@python.org>
date Mon, 09 Mar 2015 18:26:25 -0400
parents b6f601ba7f3c
children c1b966866ed7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
125
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
1 import common, hglib
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 133
diff changeset
2 from hglib.util import b
125
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
3
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
4 class test_phase(common.basetest):
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
5 """test the different ways to use the phase command"""
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
6 def test_phase(self):
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
7 """test getting data from a single changeset"""
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
8 self.append('a', 'a')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 133
diff changeset
9 rev, node0 = self.client.commit(b('first'), addremove=True)
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 133
diff changeset
10 self.assertEqual([(0, b('draft'))], self.client.phase(node0))
126
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
11 ctx = self.client[rev]
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 133
diff changeset
12 self.assertEqual(b('draft'), ctx.phase())
125
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
13
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
14 def test_phase_public(self):
126
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
15 """test phase change from draft to public"""
125
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
16 self.append('a', 'a')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 133
diff changeset
17 rev, node0 = self.client.commit(b('first'), addremove=True)
125
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
18 self.client.phase(node0, public=True)
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 133
diff changeset
19 self.assertEqual([(0, b('public'))], self.client.phase(node0))
126
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
20 ctx = self.client[rev]
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 133
diff changeset
21 self.assertEqual(b('public'), ctx.phase())
125
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
22
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
23 def test_phase_secret(self):
126
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
24 """test phase change from draft to secret"""
125
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
25 self.append('a', 'a')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 133
diff changeset
26 rev, node0 = self.client.commit(b('first'), addremove=True)
129
bcc8390d7819 tests: remove "with" usage for 2.4 compatibility
Matt Mackall <mpm@selenic.com>
parents: 126
diff changeset
27 self.assertRaises(hglib.error.CommandError,
bcc8390d7819 tests: remove "with" usage for 2.4 compatibility
Matt Mackall <mpm@selenic.com>
parents: 126
diff changeset
28 self.client.phase, node0, secret=True)
125
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
29 self.client.phase(node0, secret=True, force=True)
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 133
diff changeset
30 self.assertEqual([(0, b('secret'))], self.client.phase(node0))
126
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
31 ctx = self.client[rev]
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 133
diff changeset
32 self.assertEqual(b('secret'), ctx.phase())
126
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
33
125
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
34
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
35 def test_phase_multiple(self):
126
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
36 """test phase changes and show the phases of the different changesets"""
125
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
37 self.append('a', 'a')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 133
diff changeset
38 rev, node0 = self.client.commit(b('a'), addremove=True)
125
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
39 self.client.phase(node0, public=True)
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
40 self.append('b', 'b')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 133
diff changeset
41 rev, node1 = self.client.commit(b('b'), addremove=True)
125
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
42 self.append('c', 'c')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 133
diff changeset
43 rev, node2 = self.client.commit(b('c'), addremove=True)
125
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
44 self.client.phase(node2, secret=True, force=True)
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 133
diff changeset
45 self.assertEqual([(0, b('public')), (2, b('secret')), (1, b('draft'))],
133
b6f601ba7f3c style: fixup whitespace
Matt Mackall <mpm@selenic.com>
parents: 129
diff changeset
46 self.client.phase([node0, node2, node1]))