~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bound_sftp.py

  • Committer: John Arbash Meinel
  • Date: 2005-12-31 15:19:21 UTC
  • mto: (1587.1.6 bound-branches)
  • mto: This revision was merged to the branch mainline in revision 1590.
  • Revision ID: john@arbash-meinel.com-20051231151921-351e2877d360e537
Added special exceptions when unable to contact parent branch. Added tests for failure. bind() no longer updates the remote working tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
349
349
        self.assertEqual(['r@b-1', 'r@c-2'], b_base.revision_history())
350
350
        self.assertEqual(['r@b-1', 'r@c-2'], b_child.revision_history())
351
351
 
352
 
    # TODO: jam 20051230 Test that commit & pull fail when the branch we 
353
 
    #       are bound to is not available
 
352
    def test_commit_fails(self):
 
353
        b_base, b_child = self.create_branches()
 
354
 
 
355
        wt_child = b_child.working_tree()
 
356
        open('a', 'ab').write('child adds some text\n')
 
357
 
 
358
        del b_base
 
359
        os.rename('base', 'hidden_base')
 
360
 
 
361
        self.assertRaises(errors.BoundBranchConnectionFailure,
 
362
                wt_child.commit, 'added text', rev_id='r@c-2')
 
363
 
 
364
    def test_pull_fails(self):
 
365
        b_base, b_child = self.create_branches()
 
366
 
 
367
        b_other = copy_branch(b_child, 'other')
 
368
        wt_other = b_other.working_tree()
 
369
        open('other/a', 'wb').write('new contents\n')
 
370
        wt_other.commit('changed a', rev_id='r@d-2')
 
371
 
 
372
        wt_child = b_child.working_tree()
 
373
        self.assertEqual(['r@b-1'], b_base.revision_history())
 
374
        self.assertEqual(['r@b-1'], b_child.revision_history())
 
375
        self.assertEqual(['r@b-1', 'r@d-2'], b_other.revision_history())
 
376
 
 
377
        del b_base
 
378
        os.rename('base', 'hidden_base')
 
379
 
 
380
        self.assertRaises(errors.BoundBranchConnectionFailure,
 
381
                b_child.pull, b_other)
 
382
 
 
383
    # TODO: jam 20051231 We need invasive failure tests, so that we can show
 
384
    #       performance even when something fails.
354
385
 
355
386
 
356
387
if not paramiko_loaded: