/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport.py

  • Committer: Vincent Ladeuil
  • Date: 2007-02-11 16:06:13 UTC
  • mto: (2323.7.1 redirection)
  • mto: This revision was merged to the branch mainline in revision 2390.
  • Revision ID: v.ladeuil+lp@free.fr-20070211160613-9k1vwo0e1x0si26z
Http redirections are not followed by default. Do not use hints
anymore.

* bzrlib/transport/smart.py:
(SmartTransport.get): Do not use hints.

* bzrlib/transport/sftp.py:
(SFTPTransport.get): Do not use hints.

* bzrlib/transport/memory.py:
(MemoryTransport.get): Do not use hints.

* bzrlib/transport/local.py:
(LocalTransport.get): Do not use hints.

* bzrlib/transport/http/_urllib2_wrappers.py:
(Request.__init__): Redirections are *not* followed by default.

* bzrlib/transport/http/_urllib.py:
(HttpTransport_urllib._get): Do not use hints.

* bzrlib/transport/http/_pycurl.py:
(PyCurlTransport._get): Do not use hints.

* bzrlib/transport/http/__init__.py:
(HttpTransportBase.get, HttpTransportBase._get): Do not use hints.
Fix _get doc anyway.

* bzrlib/transport/ftp.py:
(FtpTransport.get): Do not use hints.

* bzrlib/transport/fakevfat.py:
(FakeVFATTransportDecorator.get): Do not use hints.

* bzrlib/transport/decorator.py
(TransportDecorator.get): Do not use hints.

* bzrlib/transport/chroot.py:
(ChrootTransportDecorator.get): Do not use hints.

* bzrlib/tests/test_transport_hints.py:
Deleted.

* bzrlib/tests/__init__.py:
(test_suite): Do not test hints.

* bzrlib/errors.py:
(UnknownHint): Deleted.

* bzrlib/bzrdir.py:
(BzrDirMetaFormat1.probe_transport): Do not use hints.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
from bzrlib.transport import (_CoalescedOffset,
34
34
                              _get_protocol_handlers,
35
35
                              _get_transport_modules,
36
 
                              _add_hints_to_get,
37
36
                              get_transport,
38
37
                              register_lazy_transport,
39
38
                              _set_protocol_handlers,
554
553
        self.assertEquals(t.base, here_url)
555
554
 
556
555
 
557
 
class TestTransportAPI(TestCase):
558
 
 
559
 
    def assert_get_modified(self, klass):
560
 
        """Asserts that the 'hints' parameter have been added to klass.get"""
561
 
        self.assertTrue(_add_hints_to_get(klass))
562
 
 
563
 
    def assert_get_not_modified(self, klass):
564
 
        """Asserts that the 'hints' parameter have been added to klass.get"""
565
 
        self.assertFalse(_add_hints_to_get(klass))
566
 
 
567
 
    def test_get(self):
568
 
 
569
 
        class SimpleGetWithoutHintsTransport(Transport):
570
 
            """A transport implementing get without hints"""
571
 
 
572
 
            def get(self, relpath):
573
 
                return super(SimpleGetWithoutHintsTransport, self).get(relpath)
574
 
 
575
 
 
576
 
        self.assert_get_modified(SimpleGetWithoutHintsTransport)
577
 
 
578
 
        class LessSimpleGetWoHintsTransport(Transport):
579
 
            """A transport implementing get without hints"""
580
 
 
581
 
            def get(self, relpath, par1, par2=None):
582
 
                return super(LessSimpleGetWoHintsTransport, self).get(relpath)
583
 
 
584
 
 
585
 
        self.assert_get_modified(LessSimpleGetWoHintsTransport)
586
 
 
587
 
        class SimpleGetWithHintsTransport(Transport):
588
 
            """A transport implementing get with hints"""
589
 
 
590
 
            def get(self, relpath, par1, **hints):
591
 
                return super(SimpleGetWithHintsTransport, self).get(relpath)
592
 
 
593
 
 
594
 
        self.assert_get_not_modified(SimpleGetWithHintsTransport)
595
 
 
596
 
        class StrangeGetWithHintsTransport(Transport):
597
 
            """A transport implementing get with hints but named differently"""
598
 
 
599
 
            def get(self, relpath, par1, **not_hints_but_something_else):
600
 
                return super(SimpleGetWithHintsTransport, self).get(relpath)
601
 
 
602
 
        # Borderline case, not existing today: someone use a
603
 
        # kwargs for get but for another purpose than hints. The
604
 
        # consequences are unclear, but at least this test
605
 
        # document it.
606
 
        self.assert_get_not_modified(StrangeGetWithHintsTransport)