/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_push.py

  • Committer: Curtis Hovey
  • Date: 2012-03-04 00:09:11 UTC
  • mto: This revision was merged to the branch mainline in revision 782.
  • Revision ID: sinzui.is@verizon.net-20120304000911-iaw196xcw4zfta9m
Added test to verify that DivergedBranches is handled.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from gi.repository import Gtk
20
20
 
21
21
from bzrlib import (
 
22
    errors,
22
23
    tests,
23
24
    ui,
24
25
    )
91
92
        self.assertIs(None, ui.ui_factory._progress_bar_widget)
92
93
 
93
94
    def test_on_push_clicked_without_errors(self):
94
 
        set_ui_factory()
95
 
        branch = self.make_push_branch()
96
 
        dialog = push.PushDialog(None, None, branch)
97
95
        MockMethod.bind(self, push, 'do_push', "test success")
 
96
        set_ui_factory()
 
97
        branch = self.make_push_branch()
 
98
        dialog = push.PushDialog(None, None, branch)
98
99
        MockMethod.bind(self, dialog._progress_widget, 'tick')
99
100
        dialog._combo.get_child().props.text = 'lp:~user/fnord/test'
100
101
        dialog._on_push_clicked(None)
110
111
        self.assertEqual(
111
112
            'lp:~user/fnord/test', dialog._history.get_entries()[-1])
112
113
        self.assertEqual('lp:~user/fnord/test', branch.get_push_location())
 
114
 
 
115
    def test_on_push_clicked_with_divered_branches(self):
 
116
        error = errors.DivergedBranches(None, None)
 
117
        MockMethod.bind(self, push, 'do_push', raise_error=error)
 
118
        MockMethod.bind(self, push, 'question_dialog', Gtk.ResponseType.YES)
 
119
        set_ui_factory()
 
120
        branch = self.make_push_branch()
 
121
        dialog = push.PushDialog(None, None, branch)
 
122
        dialog._combo.get_child().props.text = 'lp:~user/fnord/test'
 
123
        dialog._on_push_clicked(None)
 
124
        self.assertIs(True, push.do_push.called)
 
125
        self.assertEqual(2, push.do_push.call_count)
 
126
        self.assertEqual(
 
127
            (branch, 'lp:~user/fnord/test'), push.do_push.args)
 
128
        self.assertEqual(
 
129
            {'overwrite': True}, push.do_push.kwargs)