/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-11 17:06:34 UTC
  • mto: This revision was merged to the branch mainline in revision 788.
  • Revision ID: sinzui.is@verizon.net-20120311170634-c63bxfynru145qn4
Replace do_push with a method based on bzrlib.push.

Show diffs side-by-side

added added

removed removed

Lines of Context:
179
179
        self.assertEqual('1 revision(s) pushed.', message)
180
180
        self.assertEqual(True, progress_panel.pb.update.called)
181
181
        self.assertEqual(True, progress_panel.pb.finished.called)
 
182
 
 
183
    def test_create_push_result_unstacked(self):
 
184
        from_branch = object()
 
185
        to_branch = self.make_branch_and_tree('that').branch
 
186
        push_result = push.create_push_result(from_branch, to_branch)
 
187
        self.assertIs(from_branch, push_result.source_branch)
 
188
        self.assertIs(to_branch, push_result.target_branch)
 
189
        self.assertIs(None, push_result.branch_push_result)
 
190
        self.assertIs(None, push_result.master_branch)
 
191
        self.assertEqual(0, push_result.old_revno)
 
192
        self.assertEqual(to_branch.last_revision(), push_result.old_revid)
 
193
        self.assertIs(None, push_result.workingtree_updated)
 
194
        self.assertIs(None, push_result.stacked_on)
 
195
 
 
196
    def test_create_push_result_stacked(self):
 
197
        from_branch = object()
 
198
        to_branch = self.make_branch_and_tree('that').branch
 
199
        MockMethod.bind(self, to_branch, 'get_stacked_on_url', 'lp:project')
 
200
        push_result = push.create_push_result(from_branch, to_branch)
 
201
        self.assertEqual('lp:project', push_result.stacked_on)
 
202
 
 
203
    def test_create_push_message_stacked_on(self):
 
204
        from_branch = object()
 
205
        to_branch = self.make_branch_and_tree('that').branch
 
206
        MockMethod.bind(self, to_branch, 'get_stacked_on_url', 'lp:project')
 
207
        push_result = push.create_push_result(from_branch, to_branch)
 
208
        from_branch = self.make_from_branch()
 
209
        message = push.create_push_message(from_branch, push_result)
 
210
        self.assertEqual(
 
211
            '1 revision(s) pushed.\nStacked on lp:project.', message)
 
212
 
 
213
    def test_create_push_message_workingtree_updated_false(self):
 
214
        from_branch = object()
 
215
        to_branch = self.make_branch_and_tree('that').branch
 
216
        push_result = push.create_push_result(from_branch, to_branch)
 
217
        push_result.workingtree_updated = False
 
218
        from_branch = self.make_from_branch()
 
219
        message = push.create_push_message(from_branch, push_result)
 
220
        self.assertEqual(
 
221
            "1 revision(s) pushed.\n\nThe working tree was not updated:\n"
 
222
            "See 'bzr help working-trees' for more information.",
 
223
            message)