~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart_add.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) 2005, 2006, 2007, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
16
16
 
17
17
from cStringIO import StringIO
18
18
 
19
 
from bzrlib import (
20
 
    add,
21
 
    inventory,
22
 
    osutils,
23
 
    tests,
 
19
from bzrlib import osutils
 
20
from bzrlib.add import (
 
21
    AddAction,
 
22
    AddFromBaseAction,
24
23
    )
25
 
 
26
 
 
27
 
class AddCustomIDAction(add.AddAction):
 
24
from bzrlib.tests import TestCase, TestCaseWithTransport
 
25
from bzrlib.inventory import Inventory
 
26
 
 
27
 
 
28
class AddCustomIDAction(AddAction):
28
29
 
29
30
    def __call__(self, inv, parent_ie, path, kind):
30
31
        # The first part just logs if appropriate
38
39
        return file_id
39
40
 
40
41
 
41
 
class TestAddFrom(tests.TestCaseWithTransport):
 
42
class TestAddFrom(TestCaseWithTransport):
42
43
    """Tests for AddFromBaseAction"""
43
44
 
44
45
    def make_base_tree(self):
59
60
        try:
60
61
            new_tree.lock_write()
61
62
            try:
62
 
                action = add.AddFromBaseAction(base_tree, base_path,
63
 
                                               to_file=to_file,
64
 
                                               should_print=should_print)
 
63
                action = AddFromBaseAction(base_tree, base_path,
 
64
                                           to_file=to_file,
 
65
                                           should_print=should_print)
65
66
                new_tree.smart_add(file_list, action=action)
66
67
            finally:
67
68
                new_tree.unlock()
143
144
        self.failIf(a_id in self.base_tree)
144
145
 
145
146
 
146
 
class TestAddActions(tests.TestCase):
 
147
class TestAddActions(TestCase):
147
148
 
148
149
    def test_quiet(self):
149
150
        self.run_action("")
152
153
        self.run_action("adding path\n")
153
154
 
154
155
    def run_action(self, output):
 
156
        from bzrlib.add import AddAction
155
157
        from bzrlib.mutabletree import _FastPath
156
 
        inv = inventory.Inventory()
 
158
        inv = Inventory()
157
159
        stdout = StringIO()
158
 
        action = add.AddAction(to_file=stdout, should_print=bool(output))
 
160
        action = AddAction(to_file=stdout, should_print=bool(output))
159
161
 
160
162
        self.apply_redirected(None, stdout, None, action, inv, None,
161
163
            _FastPath('path'), 'file')