/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 tests/test_generic_processor.py

  • Committer: Ian Clatworthy
  • Date: 2009-02-20 01:03:35 UTC
  • mto: (0.64.124 trunk)
  • mto: This revision was merged to the branch mainline in revision 6631.
  • Revision ID: ian.clatworthy@canonical.com-20090220010335-qdad6kg8u69t4xgl
basic delete tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
214
214
        self.assertSymlinkTarget(branch, revtree2, path, "bbb")
215
215
 
216
216
 
 
217
class TestDelete(TestCaseForGenericProcessor):
 
218
 
 
219
    def file_command_iter(self, path, kind='file'):
 
220
        def command_list():
 
221
            author = ['', 'bugs@a.com', time.time(), time.timezone]
 
222
            committer = ['', 'elmer@a.com', time.time(), time.timezone]
 
223
            def files_one():
 
224
                yield commands.FileModifyCommand(path, kind, False,
 
225
                        None, "aaa")
 
226
            yield commands.CommitCommand('head', '1', author,
 
227
                committer, "commit 1", None, [], files_one)
 
228
            def files_two():
 
229
                yield commands.FileDeleteCommand(path)
 
230
            yield commands.CommitCommand('head', '2', author,
 
231
                committer, "commit 2", ":1", [], files_two)
 
232
        return command_list
 
233
 
 
234
    def test_delete_file_in_root(self):
 
235
        handler, branch = self.get_handler()
 
236
        path = 'a'
 
237
        handler.process(self.file_command_iter(path))
 
238
        revtree0, revtree1 = self.assertChanges(branch, 1,
 
239
            expected_added=[(path,)])
 
240
        revtree1, revtree2 = self.assertChanges(branch, 2,
 
241
            expected_removed=[(path,)])
 
242
        self.assertContent(branch, revtree1, path, "aaa")
 
243
        self.assertRevisionRoot(revtree1, path)
 
244
 
 
245
    def test_delete_file_in_subdir(self):
 
246
        handler, branch = self.get_handler()
 
247
        path = 'a/a'
 
248
        handler.process(self.file_command_iter(path))
 
249
        revtree0, revtree1 = self.assertChanges(branch, 1,
 
250
            expected_added=[('a',), (path,)])
 
251
        revtree1, revtree2 = self.assertChanges(branch, 2,
 
252
            expected_removed=[(path,)])
 
253
        self.assertContent(branch, revtree1, path, "aaa")
 
254
 
 
255
    def test_delete_symlink_in_root(self):
 
256
        handler, branch = self.get_handler()
 
257
        path = 'a'
 
258
        handler.process(self.file_command_iter(path, kind='symlink'))
 
259
        revtree1, revtree2 = self.assertChanges(branch, 2,
 
260
            expected_removed=[(path,)])
 
261
        self.assertSymlinkTarget(branch, revtree1, path, "aaa")
 
262
        self.assertRevisionRoot(revtree1, path)
 
263
 
 
264
    def test_delete_symlink_in_subdir(self):
 
265
        handler, branch = self.get_handler()
 
266
        path = 'a/a'
 
267
        handler.process(self.file_command_iter(path, kind='symlink'))
 
268
        revtree0, revtree1 = self.assertChanges(branch, 1,
 
269
            expected_added=[('a',), (path,)])
 
270
        revtree1, revtree2 = self.assertChanges(branch, 2,
 
271
            expected_removed=[(path,)])
 
272
        self.assertSymlinkTarget(branch, revtree1, path, "aaa")
 
273
 
 
274
 
217
275
class TestRename(TestCaseForGenericProcessor):
218
276
 
219
277
    def get_command_iter(self, old_path, new_path):