~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_sftp_transport.py

  • Committer: Aaron Bentley
  • Date: 2008-10-15 17:23:18 UTC
  • mto: (3777.1.9 launchpad-login)
  • mto: This revision was merged to the branch mainline in revision 3778.
  • Revision ID: aaron@aaronbentley.com-20081015172318-kg6h9v0daz8m66ns
Make testing more thorough

Show diffs side-by-side

added added

removed removed

Lines of Context:
489
489
class TestUsesAuthConfig(TestCaseWithSFTPServer):
490
490
    """Test some stuff when accessing a bzr Branch over sftp"""
491
491
 
492
 
    def test_lock_file(self):
493
 
        conf = config.AuthenticationConfig()
 
492
    def get_transport_for_connection(self, set_config):
494
493
        port = self.get_server()._listener.port
495
 
        conf._get_config().update(
496
 
            {'sftptest': {'scheme': 'sftp', 'port': port, 'user': 'bar'}})
497
 
        conf._save()
 
494
        if set_config:
 
495
            conf = config.AuthenticationConfig()
 
496
            conf._get_config().update(
 
497
                {'sftptest': {'scheme': 'sftp', 'port': port, 'user': 'bar'}})
 
498
            conf._save()
498
499
        t = get_transport('sftp://localhost:%d' % port)
 
500
        # force a connection to be performed.
499
501
        t.has('foo')
 
502
        return t
 
503
 
 
504
    def test_sftp_uses_config(self):
 
505
        t = self.get_transport_for_connection(set_config=True)
500
506
        self.assertEqual('bar', t._get_credentials()[0])
 
507
 
 
508
    def test_sftp_is_none_if_no_config(self):
 
509
        t = self.get_transport_for_connection(set_config=False)
 
510
        self.assertIs(None, t._get_credentials()[0])