~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport_implementations.py

  • Committer: Aaron Bentley
  • Date: 2007-05-14 17:21:02 UTC
  • mfrom: (2485 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2528.
  • Revision ID: aaron.bentley@utoronto.ca-20070514172102-byyl4ldjxhfxvryy
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
        """Check that transport.get(relpath).read() == content."""
62
62
        self.assertEqualDiff(content, transport.get(relpath).read())
63
63
 
 
64
    def test_ensure_base_missing(self):
 
65
        """.ensure_base() should create the directory if it doesn't exist"""
 
66
        t = self.get_transport()
 
67
        t_a = t.clone('a')
 
68
        if t_a.is_readonly():
 
69
            self.assertRaises(TransportNotPossible,
 
70
                              t_a.ensure_base)
 
71
            return
 
72
        self.assertTrue(t_a.ensure_base())
 
73
        self.assertTrue(t.has('a'))
 
74
 
 
75
    def test_ensure_base_exists(self):
 
76
        """.ensure_base() should just be happy if it already exists"""
 
77
        t = self.get_transport()
 
78
        if t.is_readonly():
 
79
            return
 
80
 
 
81
        t.mkdir('a')
 
82
        t_a = t.clone('a')
 
83
        # ensure_base returns False if it didn't create the base
 
84
        self.assertFalse(t_a.ensure_base())
 
85
 
 
86
    def test_ensure_base_missing_parent(self):
 
87
        """.ensure_base() will fail if the parent dir doesn't exist"""
 
88
        t = self.get_transport()
 
89
        if t.is_readonly():
 
90
            return
 
91
 
 
92
        t_a = t.clone('a')
 
93
        t_b = t_a.clone('b')
 
94
        self.assertRaises(NoSuchFile, t_b.ensure_base)
 
95
 
64
96
    def test_has(self):
65
97
        t = self.get_transport()
66
98