~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_ftp_transport.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-01 08:02:42 UTC
  • mfrom: (5390.3.3 faster-revert-593560)
  • Revision ID: pqm@pqm.ubuntu.com-20100901080242-esg62ody4frwmy66
(spiv) Avoid repeatedly calling self.target.all_file_ids() in
 InterTree.iter_changes. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2009, 2010, 2011 Canonical Ltd
 
1
# Copyright (C) 2006, 2010 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
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
from cStringIO import StringIO
17
18
import ftplib
18
19
import getpass
 
20
import sys
19
21
 
20
22
from bzrlib import (
21
23
    config,
23
25
    tests,
24
26
    transport,
25
27
    ui,
26
 
    urlutils,
27
28
    )
28
29
 
29
30
from bzrlib.transport import ftp
44
45
    """Test aftp transport."""
45
46
 
46
47
    def test_aftp_degrade(self):
47
 
        t = transport.get_transport_from_url('aftp://host/path')
48
 
        self.assertTrue(t.is_active)
 
48
        t = transport.get_transport('aftp://host/path')
 
49
        self.failUnless(t.is_active)
49
50
        parent = t.clone('..')
50
 
        self.assertTrue(parent.is_active)
 
51
        self.failUnless(parent.is_active)
51
52
 
52
53
        self.assertEqual('aftp://host/path', t.abspath(''))
53
54
 
82
83
    def get_url(self, relpath=None):
83
84
        """Overrides get_url to inject our user."""
84
85
        base = super(TestFTPTestServerUI, self).get_url(relpath)
85
 
        parsed_url = transport.ConnectedTransport._split_url(base)
86
 
        new_url = parsed_url.clone()
87
 
        new_url.user = self.user
88
 
        new_url.quoted_user = urlutils.quote(self.user)
89
 
        new_url.password = self.password
90
 
        new_url.quoted_password = urlutils.quote(self.password)
91
 
        return str(new_url)
 
86
        (scheme, user, password,
 
87
         host, port, path) = transport.ConnectedTransport._split_url(base)
 
88
        url = transport.ConnectedTransport._unsplit_url(
 
89
            scheme, self.user, self.password, host, port, path)
 
90
        return url
92
91
 
93
92
    def test_no_prompt_for_username(self):
94
93
        """ensure getpass.getuser() is used if there's no username in the