/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_implementations.py

  • Committer: Aaron Bentley
  • Date: 2006-11-17 04:06:03 UTC
  • mfrom: (2139 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2162.
  • Revision ID: aaron.bentley@utoronto.ca-20061117040603-pgebxndswvwk26tt
Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005, 2006 by Canonical Ltd
 
1
# Copyright (C) 2004, 2005, 2006 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
897
897
        except NotImplementedError:
898
898
            raise TestSkipped("Transport %s has no bogus URL support." %
899
899
                              self._server.__class__)
 
900
        # This should be:  but SSH still connects on construction. No COOKIE!
 
901
        # self.assertRaises((ConnectionError, NoSuchFile), t.get, '.bzr/branch')
900
902
        try:
901
903
            t = bzrlib.transport.get_transport(url)
902
904
            t.get('.bzr/branch')
959
961
            l.sort()
960
962
            return l
961
963
 
962
 
        # SftpServer creates control files in the working directory
963
 
        # so lets move down a directory to avoid those.
964
 
        if not t.is_readonly():
965
 
            t.mkdir('wd')
966
 
        else:
967
 
            os.mkdir('wd')
968
 
        t = t.clone('wd')
969
 
 
970
964
        self.assertEqual([], sorted_list('.'))
971
965
        # c2 is precisely one letter longer than c here to test that
972
966
        # suffixing is not confused.
973
967
        # a%25b checks that quoting is done consistently across transports
974
968
        tree_names = ['a', 'a%25b', 'b', 'c/', 'c/d', 'c/e', 'c2/']
 
969
 
975
970
        if not t.is_readonly():
976
971
            self.build_tree(tree_names, transport=t)
977
972
        else:
978
 
            self.build_tree(['wd/' + name for name in tree_names])
 
973
            self.build_tree(tree_names)
979
974
 
980
975
        self.assertEqual(
981
976
            ['a', 'a%2525b', 'b', 'c', 'c2'], sorted_list('.'))
985
980
            t.delete('c/d')
986
981
            t.delete('b')
987
982
        else:
988
 
            os.unlink('wd/c/d')
989
 
            os.unlink('wd/b')
 
983
            os.unlink('c/d')
 
984
            os.unlink('b')
990
985
            
991
986
        self.assertEqual(['a', 'a%2525b', 'c', 'c2'], sorted_list('.'))
992
987
        self.assertEqual(['e'], sorted_list('c'))
1117
1112
        # the abspath of "/" and "/foo/.." should result in the same location
1118
1113
        self.assertEqual(transport.abspath("/"), transport.abspath("/foo/.."))
1119
1114
 
 
1115
        self.assertEqual(transport.clone("/").abspath('foo'),
 
1116
                         transport.abspath("/foo"))
 
1117
 
1120
1118
    def test_local_abspath(self):
1121
1119
        transport = self.get_transport()
1122
1120
        try:
1309
1307
        self.assertEqual(d[2], (0, '0'))
1310
1308
        self.assertEqual(d[3], (3, '34'))
1311
1309
 
1312
 
    def test_get_smart_client(self):
1313
 
        """All transports must either give a smart client, or know they can't.
1314
 
 
1315
 
        For some transports such as http this might depend on probing to see 
1316
 
        what's actually present on the other end.  (But we can adjust for that 
1317
 
        in the future.)
 
1310
    def test_get_smart_medium(self):
 
1311
        """All transports must either give a smart medium, or know they can't.
1318
1312
        """
1319
1313
        transport = self.get_transport()
1320
1314
        try:
1321
 
            client = transport.get_smart_client()
1322
 
            # XXX: should be a more general class
1323
 
            self.assertIsInstance(client, smart.SmartStreamClient)
1324
 
        except NoSmartServer:
 
1315
            medium = transport.get_smart_medium()
 
1316
            self.assertIsInstance(medium, smart.SmartClientMedium)
 
1317
        except errors.NoSmartMedium:
1325
1318
            # as long as we got it we're fine
1326
1319
            pass
1327
1320