~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_delta.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-2010 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
221
221
 
222
222
    def show_string(self, delta, *args,  **kwargs):
223
223
        to_file = StringIO()
224
 
        _mod_delta.report_delta(to_file, delta, *args, **kwargs)
 
224
        delta.show(to_file, *args, **kwargs)
225
225
        return to_file.getvalue()
226
226
 
227
227
    def test_kind_change(self):
307
307
    def test_delta_show_short_status_no_filter(self):
308
308
        d, long_status, short_status = self._get_delta()
309
309
        out = StringIO()
310
 
        _mod_delta.report_delta(out, d, short_status=True)
 
310
        d.show(out, short_status=True)
311
311
        self.assertEquals(short_status, out.getvalue())
312
312
 
313
313
    def test_delta_show_long_status_no_filter(self):
314
314
        d, long_status, short_status = self._get_delta()
315
315
        out = StringIO()
316
 
        _mod_delta.report_delta(out, d, short_status=False)
 
316
        d.show(out, short_status=False)
317
317
        self.assertEquals(long_status, out.getvalue())
318
318
 
319
319
    def test_delta_show_no_filter(self):
321
321
        out = StringIO()
322
322
        def not_a_filter(path, file_id):
323
323
            return True
324
 
        _mod_delta.report_delta(out, d, short_status=True, filter=not_a_filter)
 
324
        d.show(out, short_status=True, filter=not_a_filter)
325
325
        self.assertEquals(short_status, out.getvalue())
326
326
 
327
327
    def test_delta_show_short_status_single_file_filter(self):
329
329
        out = StringIO()
330
330
        def only_f2(path, file_id):
331
331
            return path == 'f2'
332
 
        _mod_delta.report_delta(out, d, short_status=True, filter=only_f2)
 
332
        d.show(out, short_status=True, filter=only_f2)
333
333
        self.assertEquals("A  f2\n", out.getvalue())
334
334
 
335
335
    def test_delta_show_long_status_single_file_filter(self):
337
337
        out = StringIO()
338
338
        def only_f2(path, file_id):
339
339
            return path == 'f2'
340
 
        _mod_delta.report_delta(out, d, short_status=False, filter=only_f2)
 
340
        d.show(out, short_status=False, filter=only_f2)
341
341
        self.assertEquals("added:\n  f2\n", out.getvalue())
342
342
 
343
343
    def test_delta_show_short_status_single_file_id_filter(self):
345
345
        out = StringIO()
346
346
        def only_f2_id(path, file_id):
347
347
            return file_id == 'f2-id'
348
 
        _mod_delta.report_delta(out, d, short_status=True, filter=only_f2_id)
 
348
        d.show(out, short_status=True, filter=only_f2_id)
349
349
        self.assertEquals("A  f2\n", out.getvalue())
350
350