/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_alias.py

  • Committer: Vincent Ladeuil
  • Date: 2008-08-26 08:25:27 UTC
  • mto: (3668.1.1 trunk) (3703.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 3669.
  • Revision ID: v.ladeuil+lp@free.fr-20080826082527-109yyxzc0u24oeel
Fix all calls to tempfile.mkdtemp to osutils.mkdtemp.

* bzrlib/transform.py:
(TransformPreview.__init__): Use osutils.mkdtemp instead of
tempfile.mkdtemp.

* bzrlib/tests/test_whitebox.py:
(MoreTests.test_relpath): Use osutils.mkdtemp instead of
tempfile.mkdtemp.

* bzrlib/tests/test_setup.py:
(TestSetup.test_build_and_install): Use osutils.mkdtemp instead of
tempfile.mkdtemp.

* bzrlib/tests/test_bundle.py:
(BundleTester.get_checkout): Use osutils.mkdtemp instead of
tempfile.mkdtemp.

* bzrlib/tests/blackbox/test_outside_wt.py:
(TestOutsideWT.test_cwd_log,
TestOutsideWT.test_diff_outside_tree): Use osutils.mkdtemp instead
of tempfile.mkdtemp.

* bzrlib/smart/repository.py:
(SmartServerRepositoryTarball._copy_to_tempdir): Use
osutils.mkdtemp instead of tempfile.mkdtemp.
(SmartServerRepositoryTarball._tarfile_response): Line too long.

* bzrlib/remote.py:
(RemoteRepository._copy_repository_tarball): Use osutils.mkdtemp
instead of tempfile.mkdtemp.

* bzrlib/osutils.py:
(_mac_mkdtemp): Add docstring.

* bzrlib/mail_client.py:
(ExternalMailClient.compose): Use osutils.mkdtemp instead of
tempfile.mkdtemp.

* bzrlib/diff.py:
(DiffFromTool.__init__): Use osutils.mkdtemp instead of
tempfile.mkdtemp.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
 
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
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
#
 
17
 
 
18
"""Tests of the 'bzr alias' command."""
 
19
 
 
20
from bzrlib.tests.blackbox import ExternalBase
 
21
 
 
22
 
 
23
class TestAlias(ExternalBase):
 
24
 
 
25
    def test_list_alias_with_none(self):
 
26
        """Calling alias with no parameters lists existing aliases."""
 
27
        out, err = self.run_bzr('alias')
 
28
        self.assertEquals('', out)
 
29
 
 
30
    def test_list_unknown_alias(self):
 
31
        out, err = self.run_bzr('alias commit')
 
32
        self.assertEquals('bzr alias: commit: not found\n', out)
 
33
 
 
34
    def test_add_alias_outputs_nothing(self):
 
35
        out, err = self.run_bzr('alias commit="commit --strict"')
 
36
        self.assertEquals('', out)
 
37
 
 
38
    def test_add_alias_visible(self):
 
39
        """Adding an alias makes it ..."""
 
40
        self.run_bzr('alias commit="commit --strict"')
 
41
        out, err = self.run_bzr('alias commit')
 
42
        self.assertEquals('bzr alias commit="commit --strict"\n', out)
 
43
 
 
44
    def test_alias_listing_alphabetical(self):
 
45
        self.run_bzr('alias commit="commit --strict"')
 
46
        self.run_bzr('alias ll="log --short"')
 
47
        self.run_bzr('alias add="add -q"')
 
48
 
 
49
        out, err = self.run_bzr('alias')
 
50
        self.assertEquals(
 
51
            'bzr alias add="add -q"\n'
 
52
            'bzr alias commit="commit --strict"\n'
 
53
            'bzr alias ll="log --short"\n',
 
54
            out)
 
55
 
 
56
    def test_remove_unknown_alias(self):
 
57
        out, err = self.run_bzr('alias --remove fooix', retcode=3)
 
58
        self.assertEquals('bzr: ERROR: The alias "fooix" does not exist.\n',
 
59
                          err)
 
60
 
 
61
    def test_remove_known_alias(self):
 
62
        self.run_bzr('alias commit="commit --strict"')
 
63
        out, err = self.run_bzr('alias commit')
 
64
        self.assertEquals('bzr alias commit="commit --strict"\n', out)
 
65
        # No output when removing an existing alias.
 
66
        out, err = self.run_bzr('alias --remove commit')
 
67
        self.assertEquals('', out)
 
68
        # Now its not.
 
69
        out, err = self.run_bzr('alias commit')
 
70
        self.assertEquals("bzr alias: commit: not found\n", out)