~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport.py

  • Committer: Andrew Bennetts
  • Date: 2010-03-11 04:33:41 UTC
  • mfrom: (4797.33.4 2.1)
  • mto: This revision was merged to the branch mainline in revision 5082.
  • Revision ID: andrew.bennetts@canonical.com-20100311043341-rzdik83fnactjsxs
Merge lp:bzr/2.1, including fixes for #496813, #526211, #526353.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2011 Canonical Ltd
 
1
# Copyright (C) 2005-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
16
16
 
17
17
 
18
18
from cStringIO import StringIO
 
19
import os
19
20
import subprocess
20
21
import sys
21
22
import threading
30
31
from bzrlib.transport import (
31
32
    chroot,
32
33
    fakenfs,
33
 
    http,
34
34
    local,
35
35
    memory,
36
36
    pathfilter,
563
563
        server = HttpServer()
564
564
        self.start_server(server)
565
565
        t = transport.get_transport('readonly+' + server.get_url())
566
 
        self.assertIsInstance(t, readonly.ReadonlyTransportDecorator)
 
566
        self.failUnless(isinstance(t, readonly.ReadonlyTransportDecorator))
567
567
        self.assertEqual(False, t.listable())
568
568
        self.assertEqual(True, t.is_readonly())
569
569
 
746
746
        self.assertEquals(t._host, 'simple.example.com')
747
747
        self.assertEquals(t._port, None)
748
748
        self.assertEquals(t._path, '/home/source/')
749
 
        self.assertTrue(t._user is None)
750
 
        self.assertTrue(t._password is None)
 
749
        self.failUnless(t._user is None)
 
750
        self.failUnless(t._password is None)
751
751
 
752
752
        self.assertEquals(t.base, 'http://simple.example.com/home/source/')
753
753
 
955
955
        ssh_server = stub_sftp.SFTPFullAbsoluteServer(StubSSHServer)
956
956
        # We *don't* want to override the default SSH vendor: the detected one
957
957
        # is the one to use.
958
 
 
959
 
        # FIXME: I don't understand the above comment, SFTPFullAbsoluteServer
960
 
        # inherits from SFTPServer which forces the SSH vendor to
961
 
        # ssh.ParamikoVendor(). So it's forced, not detected. --vila 20100623
962
958
        self.start_server(ssh_server)
963
 
        port = ssh_server.port
 
959
        port = ssh_server._listener.port
964
960
 
965
961
        if sys.platform == 'win32':
966
962
            bzr_remote_path = sys.executable + ' ' + self.get_bzr_path()
967
963
        else:
968
964
            bzr_remote_path = self.get_bzr_path()
969
 
        self.overrideEnv('BZR_REMOTE_PATH', bzr_remote_path)
 
965
        os.environ['BZR_REMOTE_PATH'] = bzr_remote_path
970
966
 
971
967
        # Access the branch via a bzr+ssh URL.  The BZR_REMOTE_PATH environment
972
968
        # variable is used to tell bzr what command to run on the remote end.
993
989
        # And the rest are threads
994
990
        for t in started[1:]:
995
991
            t.join()
996
 
 
997
 
 
998
 
class TestUnhtml(tests.TestCase):
999
 
 
1000
 
    """Tests for unhtml_roughly"""
1001
 
 
1002
 
    def test_truncation(self):
1003
 
        fake_html = "<p>something!\n" * 1000
1004
 
        result = http.unhtml_roughly(fake_html)
1005
 
        self.assertEquals(len(result), 1000)
1006
 
        self.assertStartsWith(result, " something!")