~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport_implementations.py

Make sure list_dir always returns url-escaped names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
733
733
            os.mkdir('wd')
734
734
        t = t.clone('wd')
735
735
 
736
 
        self.assertEqual([], sorted_list(u'.'))
 
736
        self.assertEqual([], sorted_list('.'))
737
737
        # c2 is precisely one letter longer than c here to test that
738
738
        # suffixing is not confused.
739
739
        if not t.is_readonly():
741
741
        else:
742
742
            self.build_tree(['wd/a', 'wd/b', 'wd/c/', 'wd/c/d', 'wd/c/e', 'wd/c2/'])
743
743
 
744
 
        self.assertEqual([u'a', u'b', u'c', u'c2'], sorted_list(u'.'))
745
 
        self.assertEqual([u'd', u'e'], sorted_list(u'c'))
 
744
        self.assertEqual(['a', 'b', 'c', 'c2'], sorted_list('.'))
 
745
        self.assertEqual(['d', 'e'], sorted_list('c'))
746
746
 
747
747
        if not t.is_readonly():
748
748
            t.delete('c/d')
751
751
            os.unlink('wd/c/d')
752
752
            os.unlink('wd/b')
753
753
            
754
 
        self.assertEqual([u'a', u'c', u'c2'], sorted_list('.'))
755
 
        self.assertEqual([u'e'], sorted_list(u'c'))
 
754
        self.assertEqual(['a', 'c', 'c2'], sorted_list('.'))
 
755
        self.assertEqual(['e'], sorted_list('c'))
756
756
 
757
757
        self.assertListRaises(PathError, t.list_dir, 'q')
758
758
        self.assertListRaises(PathError, t.list_dir, 'c/f')
759
759
        self.assertListRaises(PathError, t.list_dir, 'a')
760
760
 
 
761
    def test_list_dir_result_is_url_escaped(self):
 
762
        t = self.get_transport()
 
763
        if not t.listable():
 
764
            raise TestSkipped("transport not listable")
 
765
 
 
766
        if not t.is_readonly():
 
767
            self.build_tree(['a/', 'a/%'], transport=t)
 
768
        else:
 
769
            self.build_tree(['a/', 'a/%'])
 
770
        
 
771
        self.assertEqual(['%25'], list(t.list_dir('a')))
 
772
 
761
773
    def test_clone(self):
762
774
        # TODO: Test that clone moves up and down the filesystem
763
775
        t1 = self.get_transport()