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

  • Committer: Aaron Bentley
  • Date: 2008-05-09 03:34:41 UTC
  • mto: This revision was merged to the branch mainline in revision 492.
  • Revision ID: aaron@aaronbentley.com-20080509033441-6tdpc72hzxiu754o
Test successful merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import os
20
20
 
21
21
from bzrlib import tests
 
22
from bzrlib.merge_directive import MergeDirective
22
23
 
23
24
from bzrlib.plugins.gtk.diff import (
24
25
    DiffController,
25
26
    DiffView,
26
27
    iter_changes_to_status,
 
28
    MergeDirectiveController,
27
29
    )
28
30
eg_diff = """\
29
31
=== modified file 'tests/test_diff.py'
106
108
    def _get_save_path(self, basename):
107
109
        return 'save-path'
108
110
 
 
111
    def _get_merge_target(self):
 
112
        return 'other'
 
113
 
 
114
    def destroy(self):
 
115
        pass
 
116
 
 
117
    def _merge_successful(self):
 
118
        self.merge_successful = True
 
119
 
109
120
 
110
121
class TestDiffController(tests.TestCaseWithTransport):
111
122
 
140
151
        self.assertFileEqual('foo', 'save-path')
141
152
 
142
153
 
 
154
class TestMergeDirectiveController(tests.TestCaseWithTransport):
 
155
 
 
156
    def test_perform_merge(self):
 
157
        this = self.make_branch_and_tree('this')
 
158
        this.commit('first commit')
 
159
        other = this.bzrdir.sprout('other').open_workingtree()
 
160
        other.commit('second commit')
 
161
        other.lock_write()
 
162
        try:
 
163
            directive = MergeDirective.from_objects(other.branch.repository,
 
164
                                                    other.last_revision(), 0,
 
165
                                                    0, 'this')
 
166
        finally:
 
167
            other.unlock()
 
168
        window = MockWindow()
 
169
        controller = MergeDirectiveController('directive', directive, window)
 
170
        controller.perform_merge(window)
 
171
        self.assertTrue(window.merge_successful)
 
172
 
 
173
 
143
174
class Test_IterChangesToStatus(tests.TestCaseWithTransport):
144
175
 
145
176
    def assertStatusEqual(self, expected, tree):