bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
1 |
# Copyright (C) 2006, 2007, 2009, 2010, 2016 Canonical Ltd
|
|
2052.3.1
by John Arbash Meinel
Add tests to cleanup the copyright of all source files |
2 |
#
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
16 |
"""Black-box tests for brz aliases.
|
|
1553.6.6
by Erik Bågfors
blackbox tests for aliases,--no-aliases and aliases with options |
17 |
"""
|
18 |
||
19 |
import os |
|
20 |
||
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
21 |
from breezy import config |
22 |
from breezy.branch import Branch |
|
23 |
from breezy.tests import TestCaseWithTransport |
|
24 |
from breezy.trace import mutter |
|
|
1553.6.6
by Erik Bågfors
blackbox tests for aliases,--no-aliases and aliases with options |
25 |
|
|
1553.6.9
by Erik Bågfors
PEP8-ify |
26 |
|
|
5283.4.5
by Martin Pool
Update remaining subclasses of ExternalBase |
27 |
class TestAliases(TestCaseWithTransport): |
|
1553.6.6
by Erik Bågfors
blackbox tests for aliases,--no-aliases and aliases with options |
28 |
|
29 |
def test_aliases(self): |
|
30 |
||
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
31 |
def bzr(args, **kwargs): |
32 |
return self.run_bzr(args, **kwargs)[0] |
|
|
1553.6.6
by Erik Bågfors
blackbox tests for aliases,--no-aliases and aliases with options |
33 |
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
34 |
def bzr_catch_error(args, **kwargs): |
35 |
return self.run_bzr(args, **kwargs)[1] |
|
|
1553.6.16
by Erik Bågfors
better test for --no-aliases |
36 |
|
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
37 |
conf = config.GlobalConfig.from_string(b'''[ALIASES] |
|
5345.1.15
by Vincent Ladeuil
Cleanup bb.test_aliases |
38 |
c=cat
|
39 |
c1=cat -r 1
|
|
40 |
c2=cat -r 1 -r2
|
|
|
5345.1.25
by Vincent Ladeuil
Move the '_save' parameter from '__init__' to 'from_bytes', fix fallouts. |
41 |
''', save=True) |
|
1553.6.7
by Erik Bågfors
test for option overrides |
42 |
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
43 |
str1 = 'foo\n' |
44 |
str2 = 'bar\n' |
|
|
1553.6.6
by Erik Bågfors
blackbox tests for aliases,--no-aliases and aliases with options |
45 |
|
|
2664.6.2
by Daniel Watkins
tests.blackbox.test_aliases now uses internals where appropriate. |
46 |
tree = self.make_branch_and_tree('.') |
47 |
self.build_tree_contents([('a', str1)]) |
|
48 |
tree.add('a') |
|
49 |
tree.commit(message='1') |
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
50 |
|
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
51 |
self.assertEqual(bzr('c a'), str1) |
|
1553.6.6
by Erik Bågfors
blackbox tests for aliases,--no-aliases and aliases with options |
52 |
|
|
2664.6.2
by Daniel Watkins
tests.blackbox.test_aliases now uses internals where appropriate. |
53 |
self.build_tree_contents([('a', str2)]) |
54 |
tree.commit(message='2') |
|
|
1553.6.6
by Erik Bågfors
blackbox tests for aliases,--no-aliases and aliases with options |
55 |
|
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
56 |
self.assertEqual(bzr('c a'), str2) |
57 |
self.assertEqual(bzr('c1 a'), str1) |
|
58 |
self.assertEqual(bzr('c1 --revision 2 a'), str2) |
|
|
1553.6.6
by Erik Bågfors
blackbox tests for aliases,--no-aliases and aliases with options |
59 |
|
|
1553.6.16
by Erik Bågfors
better test for --no-aliases |
60 |
# If --no-aliases isn't working, we will not get retcode=3
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
61 |
bzr('--no-aliases c a', retcode=3) |
|
1553.6.6
by Erik Bågfors
blackbox tests for aliases,--no-aliases and aliases with options |
62 |
|
|
1553.6.16
by Erik Bågfors
better test for --no-aliases |
63 |
# If --no-aliases breaks all of bzr, we also get retcode=3
|
64 |
# So we need to catch the output as well
|
|
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
65 |
self.assertEqual(bzr_catch_error('--no-aliases c a', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
66 |
retcode=None), |
67 |
'brz: ERROR: unknown command "c". '
|
|
68 |
'Perhaps you meant "ci"\n') |
|
|
1553.6.16
by Erik Bågfors
better test for --no-aliases |
69 |
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
70 |
bzr('c -r1 -r2', retcode=3) |
71 |
bzr('c1 -r1 -r2', retcode=3) |
|
|
1553.6.7
by Erik Bågfors
test for option overrides |
72 |
bzr('c2', retcode=3) |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
73 |
bzr('c2 -r1', retcode=3) |