/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to tests/test_commit.py

  • Committer: John Arbash Meinel
  • Date: 2007-10-02 18:08:58 UTC
  • mto: (322.1.1 trunk) (330.3.3 trunk)
  • mto: This revision was merged to the branch mainline in revision 368.
  • Revision ID: john@arbash-meinel.com-20071002180858-dtnzn5aclokxw0fp
Add the 'Only Commit Locally' checkbox, we may want to put it elsewhere, though.

Show diffs side-by-side

added added

removed removed

Lines of Context:
182
182
 
183
183
class TestCommitDialog(tests.TestCaseWithTransport):
184
184
 
 
185
    def test_bound(self):
 
186
        tree = self.make_branch_and_tree('tree')
 
187
        rev_id = tree.commit('first')
 
188
        tree2 = tree.bzrdir.sprout('tree2').open_workingtree()
 
189
        tree2.branch.bind(tree.branch)
 
190
 
 
191
        # tree is not a checkout
 
192
        dlg = commit.CommitDialog(tree)
 
193
        self.assertFalse(dlg._check_local.get_property('visible'))
 
194
 
 
195
        # tree2 is a checkout
 
196
        dlg2 = commit.CommitDialog(tree2)
 
197
        self.assertTrue(dlg2._check_local.get_property('visible'))
 
198
 
185
199
    def test_no_pending(self):
186
200
        tree = self.make_branch_and_tree('tree')
187
201
        rev_id1 = tree.commit('one')
188
202
 
189
203
        dlg = commit.CommitDialog(tree)
190
 
        # TODO: assert that the pending box is hidden
 
204
 
 
205
        self.assertFalse(dlg._pending_box.get_property('visible'))
 
206
 
191
207
        commit_col = dlg._treeview_files.get_column(0)
192
208
        self.assertEqual('Commit', commit_col.get_title())
193
209
        renderer = commit_col.get_cell_renderers()[0]
205
221
        tree.merge_from_branch(tree2.branch)
206
222
 
207
223
        dlg = commit.CommitDialog(tree)
208
 
        # TODO: assert that the pending box is set to show
 
224
 
 
225
        self.assertTrue(dlg._pending_box.get_property('visible'))
 
226
 
209
227
        commit_col = dlg._treeview_files.get_column(0)
210
228
        self.assertEqual('Commit*', commit_col.get_title())
211
229
        renderer = commit_col.get_cell_renderers()[0]
543
561
class TestCommitDialog_Commit(tests.TestCaseWithTransport):
544
562
    """Tests on the actual 'commit' button being pushed."""
545
563
 
 
564
    def test_bound_commit_local(self):
 
565
        tree = self.make_branch_and_tree('tree')
 
566
        self.build_tree(['tree/a'])
 
567
        tree.add(['a'], ['a-id'])
 
568
        rev_id1 = tree.commit('one')
 
569
 
 
570
        tree2 = tree.bzrdir.sprout('tree2').open_workingtree()
 
571
        self.build_tree(['tree2/b'])
 
572
        tree2.add(['b'], ['b-id'])
 
573
        tree2.branch.bind(tree.branch)
 
574
 
 
575
        dlg = commit.CommitDialog(tree2)
 
576
        # With the check box set, it should only effect the local branch
 
577
        dlg._check_local.set_active(True)
 
578
        dlg._set_global_commit_message('Commit message\n')
 
579
        dlg._do_commit()
 
580
 
 
581
        last_rev = tree2.last_revision()
 
582
        self.assertEqual(last_rev, dlg.committed_revision_id)
 
583
        self.assertEqual(rev_id1, tree.branch.last_revision())
 
584
 
 
585
    def test_bound_commit_both(self):
 
586
        tree = self.make_branch_and_tree('tree')
 
587
        self.build_tree(['tree/a'])
 
588
        tree.add(['a'], ['a-id'])
 
589
        rev_id1 = tree.commit('one')
 
590
 
 
591
        tree2 = tree.bzrdir.sprout('tree2').open_workingtree()
 
592
        self.build_tree(['tree2/b'])
 
593
        tree2.add(['b'], ['b-id'])
 
594
        tree2.branch.bind(tree.branch)
 
595
 
 
596
        dlg = commit.CommitDialog(tree2)
 
597
        # With the check box set, it should only effect the local branch
 
598
        dlg._check_local.set_active(False)
 
599
        dlg._set_global_commit_message('Commit message\n')
 
600
        dlg._do_commit()
 
601
 
 
602
        last_rev = tree2.last_revision()
 
603
        self.assertEqual(last_rev, dlg.committed_revision_id)
 
604
        self.assertEqual(last_rev, tree.branch.last_revision())
 
605
 
546
606
    def test_commit_no_message(self):
547
607
        tree = self.make_branch_and_tree('tree')
548
608
        self.build_tree(['tree/a', 'tree/b'])
573
633
        # By saying NO, nothing should be committed.
574
634
        self.assertEqual(rev_id, tree.last_revision())
575
635
        self.assertIs(None, dlg.committed_revision_id)
 
636
        self.assertTrue(dlg._global_message_text_view.get_property('is-focus'))
576
637
 
577
638
        dlg._question_dialog = _question_ok
578
639
        del questions[:]
593
654
        tree.add(['a'], ['a-id'])
594
655
 
595
656
        dlg = commit.CommitDialog(tree)
596
 
        dlg._global_message_text_view.get_buffer().set_text('Some text\n')
 
657
        dlg._set_global_commit_message('Some text\n')
597
658
        dlg._do_commit()
598
659
 
599
660
        last_rev = tree.last_revision()