~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport.py

  • Committer: Jelmer Vernooij
  • Date: 2009-02-23 20:55:58 UTC
  • mfrom: (4034 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4053.
  • Revision ID: jelmer@samba.org-20090223205558-1cx2k4w1zgs8r5qa
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
107
107
        finally:
108
108
            # restore original values
109
109
            _set_protocol_handlers(saved_handlers)
110
 
            
 
110
 
111
111
    def test_transport_fallback(self):
112
112
        """Transport with missing dependency causes no error"""
113
113
        saved_handlers = _get_protocol_handlers()
123
123
        finally:
124
124
            _set_protocol_handlers(saved_handlers)
125
125
 
 
126
    def test_ssh_hints(self):
 
127
        """Transport ssh:// should raise an error pointing out bzr+ssh://"""
 
128
        try:
 
129
            get_transport('ssh://fooserver/foo')
 
130
        except UnsupportedProtocol, e:
 
131
            e_str = str(e)
 
132
            self.assertEquals('Unsupported protocol'
 
133
                              ' for url "ssh://fooserver/foo":'
 
134
                              ' bzr supports bzr+ssh to operate over ssh, use "bzr+ssh://fooserver/foo".',
 
135
                              str(e))
 
136
        else:
 
137
            self.fail('Did not raise UnsupportedProtocol')
 
138
 
126
139
    def test_LateReadError(self):
127
140
        """The LateReadError helper should raise on read()."""
128
141
        a_file = LateReadError('a path')
368
381
        self.assertEqual(server, relpath_cloned.server)
369
382
        self.assertEqual(server, abspath_cloned.server)
370
383
        server.tearDown()
371
 
    
 
384
 
372
385
    def test_chroot_url_preserves_chroot(self):
373
386
        """Calling get_transport on a chroot transport's base should produce a
374
387
        transport with exactly the same behaviour as the original chroot
386
399
        self.assertEqual(transport.server, new_transport.server)
387
400
        self.assertEqual(transport.base, new_transport.base)
388
401
        server.tearDown()
389
 
        
 
402
 
390
403
    def test_urljoin_preserves_chroot(self):
391
404
        """Using urlutils.join(url, '..') on a chroot URL should not produce a
392
405
        URL that escapes the intended chroot.
551
564
 
552
565
class TestTransportImplementation(TestCaseInTempDir):
553
566
    """Implementation verification for transports.
554
 
    
 
567
 
555
568
    To verify a transport we need a server factory, which is a callable
556
569
    that accepts no parameters and returns an implementation of
557
570
    bzrlib.transport.Server.
558
 
    
 
571
 
559
572
    That Server is then used to construct transport instances and test
560
573
    the transport via loopback activity.
561
574
 
562
 
    Currently this assumes that the Transport object is connected to the 
563
 
    current working directory.  So that whatever is done 
564
 
    through the transport, should show up in the working 
 
575
    Currently this assumes that the Transport object is connected to the
 
576
    current working directory.  So that whatever is done
 
577
    through the transport, should show up in the working
565
578
    directory, and vice-versa. This is a bug, because its possible to have
566
 
    URL schemes which provide access to something that may not be 
567
 
    result in storage on the local disk, i.e. due to file system limits, or 
 
579
    URL schemes which provide access to something that may not be
 
580
    result in storage on the local disk, i.e. due to file system limits, or
568
581
    due to it being a database or some other non-filesystem tool.
569
582
 
570
583
    This also tests to make sure that the functions work with both
571
584
    generators and lists (assuming iter(list) is effectively a generator)
572
585
    """
573
 
    
 
586
 
574
587
    def setUp(self):
575
588
        super(TestTransportImplementation, self).setUp()
576
589
        self._server = self.transport_server()