~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/commands/test_revert.py

  • Committer: Vincent Ladeuil
  • Date: 2009-04-27 16:10:10 UTC
  • mto: (4310.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4311.
  • Revision ID: v.ladeuil+lp@free.fr-20090427161010-7swfzeagf63cpixd
Fix bug #367726 by reverting some default user handling introduced
while fixing bug #256612.

* bzrlib/transport/ssh.py:
(_paramiko_auth): Explicitly use getpass.getuser() as default
user.

* bzrlib/transport/ftp/_gssapi.py:
(GSSAPIFtpTransport._create_connection): Explicitly use
getpass.getuser() as default user.

* bzrlib/transport/ftp/__init__.py:
(FtpTransport._create_connection): Explicitly use
getpass.getuser() as default user.

* bzrlib/tests/test_sftp_transport.py:
(TestUsesAuthConfig.test_sftp_is_none_if_no_config)
(TestUsesAuthConfig.test_sftp_doesnt_prompt_username): Revert to
None as the default user.

* bzrlib/tests/test_remote.py:
(TestRemoteSSHTransportAuthentication): The really offending one:
revert to None as the default user.

* bzrlib/tests/test_config.py:
(TestAuthenticationConfig.test_username_default_no_prompt): Update
test (and some PEP8).

* bzrlib/smtp_connection.py:
(SMTPConnection._authenticate): Revert to None as the default
user.

* bzrlib/plugins/launchpad/account.py:
(_get_auth_user): Revert default value handling.

* bzrlib/config.py:
(AuthenticationConfig.get_user): Fix doc-string. Leave default
value handling to callers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2010 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
 
 
17
 
import os
18
 
from bzrlib import (
19
 
    branch,
20
 
    builtins,
21
 
    errors,
22
 
    lock,
23
 
    )
24
 
from bzrlib.tests import (
25
 
    transport_util,
26
 
    TestCaseInTempDir,
27
 
    )
28
 
 
29
 
 
30
 
class TestRevert(TestCaseInTempDir):
31
 
 
32
 
    def setUp(self):
33
 
        super(TestRevert, self).setUp()
34
 
 
35
 
    def test_revert_tree_write_lock_and_branch_read_lock(self):
36
 
 
37
 
        # install lock hooks to find out about cmd_revert's locking actions
38
 
        locks_acquired = []
39
 
        locks_released = []
40
 
        lock.Lock.hooks.install_named_hook('lock_acquired',
41
 
            locks_acquired.append, None)
42
 
        lock.Lock.hooks.install_named_hook('lock_released',
43
 
            locks_released.append, None)
44
 
 
45
 
        # execute the revert command (There is nothing to actually revert,
46
 
        # but locks are acquired either way.)
47
 
        revert = builtins.cmd_revert()
48
 
        revert.run()
49
 
 
50
 
        # make sure that only one lock is acquired and released.
51
 
        self.assertLength(1, locks_acquired)
52
 
        self.assertLength(1, locks_released)
53
 
 
54
 
        # make sure that the nonces are the same, since otherwise
55
 
        # this would not be the same lock.
56
 
        self.assertEqual(locks_acquired[0].details, locks_released[0].details)
57
 
 
58
 
        # make sure that the locks are checkout locks.
59
 
        self.assertEndsWith(locks_acquired[0].lock_url, "/checkout/lock")
60
 
        self.assertEndsWith(locks_released[0].lock_url, "/checkout/lock")
61