~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_reconfigure.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) 2007, 2008, 2009 Canonical Ltd
 
1
# Copyright (C) 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 bzrlib import (
18
18
    branch as _mod_branch,
19
 
    bzrdir,
20
19
    errors,
21
20
    reconfigure,
22
21
    repository,
44
43
        self.assertRaises(errors.NoWorkingTree, workingtree.WorkingTree.open,
45
44
                          'tree')
46
45
 
47
 
    def test_tree_with_pending_merge_to_branch(self):
48
 
        tree = self.make_branch_and_tree('tree')
49
 
        other_tree = tree.bzrdir.sprout('other').open_workingtree()
50
 
        self.build_tree(['other/file'])
51
 
        other_tree.add('file')
52
 
        other_tree.commit('file added')
53
 
        tree.merge_from_branch(other_tree.branch)
54
 
        reconfiguration = reconfigure.Reconfigure.to_branch(tree.bzrdir)
55
 
        self.assertRaises(errors.UncommittedChanges, reconfiguration.apply)
56
 
        reconfiguration.apply(force=True)
57
 
        self.assertRaises(errors.NoWorkingTree, workingtree.WorkingTree.open,
58
 
                          'tree')
59
 
 
60
46
    def test_branch_to_branch(self):
61
47
        branch = self.make_branch('branch')
62
48
        self.assertRaises(errors.AlreadyBranch,
431
417
            reconfigure.Reconfigure.set_repository_trees, tree.bzrdir, None)
432
418
        self.assertContainsRe(str(e),
433
419
            r"Requested reconfiguration of '.*' is not supported.")
434
 
 
435
 
    def test_lightweight_checkout_to_tree_preserves_reference_locations(self):
436
 
        format = bzrdir.format_registry.make_bzrdir('1.9')
437
 
        format.set_branch_format(_mod_branch.BzrBranchFormat8())
438
 
        tree = self.make_branch_and_tree('tree', format=format)
439
 
        tree.branch.set_reference_info('file_id', 'path', '../location')
440
 
        checkout = tree.branch.create_checkout('checkout', lightweight=True)
441
 
        reconfiguration = reconfigure.Reconfigure.to_tree(checkout.bzrdir)
442
 
        reconfiguration.apply()
443
 
        checkout_branch = checkout.bzrdir.open_branch()
444
 
        self.assertEqual(('path', '../location'),
445
 
                         checkout_branch.get_reference_info('file_id'))