~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport_implementations.py

  • Committer: John Arbash Meinel
  • Date: 2006-09-05 19:34:34 UTC
  • mto: (1946.2.8 reduce-knit-churn)
  • mto: This revision was merged to the branch mainline in revision 1988.
  • Revision ID: john@arbash-meinel.com-20060905193434-2ae27ba5c50bae61
Lots of deprecation warnings, but no errors

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
        t = self.get_transport()
133
133
 
134
134
        if t.is_readonly():
135
 
            self.assertRaises(TransportNotPossible,
136
 
                    t.put, 'a', StringIO('some text for a\n'))
137
 
            return
138
 
 
139
 
        t.put('a', StringIO('some text for a\n'))
140
 
        self.failUnless(t.has('a'))
141
 
        self.check_transport_contents('some text for a\n', t, 'a')
142
 
        # Make sure 'has' is updated
143
 
        self.assertEqual(list(t.has_multi(['a', 'b', 'c', 'd', 'e'])),
144
 
                [True, False, False, False, False])
145
 
        # Put also replaces contents
 
135
            return
 
136
 
 
137
        deprecation_msg = '%s.%s.%s was deprecated in version 0.11.' % (
 
138
            t.put.im_class.__module__, t.put.im_class.__name__,
 
139
            t.put.__name__)
 
140
        self.callDeprecated([deprecation_msg],
 
141
                            t.put, 'a', 'string\ncontents\n')
 
142
        self.check_transport_contents('string\ncontents\n', t, 'a')
 
143
 
 
144
        self.callDeprecated([deprecation_msg],
 
145
                            t.put, 'b', StringIO('file-like\ncontents\n'))
 
146
        self.check_transport_contents('file-like\ncontents\n', t, 'b')
 
147
 
 
148
    def test_put_multi(self):
 
149
        t = self.get_transport()
 
150
 
 
151
        if t.is_readonly():
 
152
            return
146
153
        self.assertEqual(t.put_multi([('a', StringIO('new\ncontents for\na\n')),
147
154
                                      ('d', StringIO('contents\nfor d\n'))]),
148
155
                         2)
149
 
        self.assertEqual(list(t.has_multi(['a', 'b', 'c', 'd', 'e'])),
150
 
                [True, False, False, True, False])
 
156
        self.assertEqual(list(t.has_multi(['a', 'b', 'c', 'd'])),
 
157
                [True, False, False, True])
151
158
        self.check_transport_contents('new\ncontents for\na\n', t, 'a')
152
159
        self.check_transport_contents('contents\nfor d\n', t, 'd')
153
160
 
158
165
        self.check_transport_contents('diff\ncontents for\na\n', t, 'a')
159
166
        self.check_transport_contents('another contents\nfor d\n', t, 'd')
160
167
 
 
168
    def test_put_file(self):
 
169
        t = self.get_transport()
 
170
 
 
171
        if t.is_readonly():
 
172
            self.assertRaises(TransportNotPossible,
 
173
                    t.put_file, 'a', StringIO('some text for a\n'))
 
174
            return
 
175
 
 
176
        t.put_file('a', StringIO('some text for a\n'))
 
177
        self.failUnless(t.has('a'))
 
178
        self.check_transport_contents('some text for a\n', t, 'a')
 
179
        # Put also replaces contents
 
180
        t.put_file('a', StringIO('new\ncontents for\na\n'))
 
181
        self.check_transport_contents('new\ncontents for\na\n', t, 'a')
161
182
        self.assertRaises(NoSuchFile,
162
183
                          t.put, 'path/doesnt/exist/c', StringIO('contents'))
163
184