annotate tests/test-phase.py @ 154:11202c85737e

hglib: make sure hgclient.diff() works with bytes (issue4520)
author Brett Cannon <brett@python.org>
date Wed, 25 Mar 2015 20:15:54 -0400
parents c1b966866ed7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
148
c1b966866ed7 hglib: make all imports absolute (issue4520)
Brett Cannon <brett@python.org>
parents: 143
diff changeset
1 from tests import common
c1b966866ed7 hglib: make all imports absolute (issue4520)
Brett Cannon <brett@python.org>
parents: 143
diff changeset
2 import hglib
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 133
diff changeset
3 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
4
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
5 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
6 """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
7 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
8 """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
9 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
10 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
11 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
12 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
13 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
14
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
15 def test_phase_public(self):
126
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
16 """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
17 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
18 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
19 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
20 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
21 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
22 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
23
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
24 def test_phase_secret(self):
126
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
25 """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
26 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
27 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
28 self.assertRaises(hglib.error.CommandError,
bcc8390d7819 tests: remove "with" usage for 2.4 compatibility
Matt Mackall <mpm@selenic.com>
parents: 126
diff changeset
29 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
30 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
31 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
32 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
33 self.assertEqual(b('secret'), ctx.phase())
126
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
34
125
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
35
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
36 def test_phase_multiple(self):
126
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
37 """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
38 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
39 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
40 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
41 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
42 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
43 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
44 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
45 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
46 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
47 self.client.phase([node0, node2, node1]))