~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport.py

  • Committer: Vincent Ladeuil
  • Date: 2007-05-03 09:59:47 UTC
  • mto: (2485.8.14 reuse.transports)
  • mto: This revision was merged to the branch mainline in revision 2646.
  • Revision ID: v.ladeuil+lp@free.fr-20070503095947-k2o8rnp5ug6uriu1
Naive implementation of transport reuse by Transport.get_transport().

* transport/__init__.py:
(get_transport): Accept a list of reusable transports as a
parameter.

* tests/test_transport.py:
(TestReusedTransports): Some basic tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
592
592
        # make sure we reach the root
593
593
        t = t.clone('..')
594
594
        self.assertEquals(t.base, 'file://HOST/')
 
595
 
 
596
 
 
597
class TestReusedTransports(TestCase):
 
598
 
 
599
    def test_reuse_same_transport(self):
 
600
        t = get_transport('http://foo/')
 
601
        t2 = get_transport('http://foo/', transports=[t])
 
602
        self.assertIs(t, t2)
 
603
 
 
604
    def test_don_t_reuse_different_transport(self):
 
605
        t = get_transport('http://foo/')
 
606
        t2 = get_transport('http://bar/', transports=[t])
 
607
        self.assertIsNot(t, t2)