~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart.py

Refactor SmartServerBranchRequest out from SmartServerRequestRevisionHistory to
allow easier writing of smartserver Branch methods.
(Wouter van Heyst, Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
177
177
 
178
178
class TestSmartServerRequestRevisionHistory(tests.TestCaseWithTransport):
179
179
 
180
 
    def test_no_branch(self):
181
 
        """When there is a bzrdir and no branch, NotBranchError is raised."""
182
 
        backing = self.get_transport()
183
 
        request = smart.branch.SmartServerRequestRevisionHistory(backing)
184
 
        self.make_bzrdir('.')
185
 
        self.assertRaises(errors.NotBranchError,
186
 
            request.execute, backing.local_abspath(''))
187
 
 
188
180
    def test_empty(self):
189
181
        """For an empty branch, the body is empty."""
190
182
        backing = self.get_transport()
207
199
            ('\x00'.join([r1, r2])).encode('utf8')),
208
200
            request.execute(backing.local_abspath('')))
209
201
 
 
202
 
 
203
class TestSmartServerBranchRequest(tests.TestCaseWithTransport):
 
204
 
 
205
    def test_no_branch(self):
 
206
        """When there is a bzrdir and no branch, NotBranchError is raised."""
 
207
        backing = self.get_transport()
 
208
        request = smart.branch.SmartServerBranchRequest(backing)
 
209
        self.make_bzrdir('.')
 
210
        self.assertRaises(errors.NotBranchError,
 
211
            request.execute, backing.local_abspath(''))
 
212
 
210
213
    def test_branch_reference(self):
211
214
        """When there is a branch reference, NotBranchError is raised."""
212
215
        backing = self.get_transport()
213
 
        request = smart.branch.SmartServerRequestRevisionHistory(backing)
 
216
        request = smart.branch.SmartServerBranchRequest(backing)
214
217
        branch = self.make_branch('branch')
215
218
        checkout = branch.create_checkout('reference',lightweight=True)
216
219
        self.assertRaises(errors.NotBranchError,