~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart.py

HPSS call 'BzrDir.destroy_branch'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
221
221
        self.assertEqual(expected, request.execute('', 'False'))
222
222
 
223
223
 
 
224
class TestSmartServerBzrDirRequestDestroyBranch(
 
225
    tests.TestCaseWithMemoryTransport):
 
226
    """Tests for BzrDir.destroy_branch."""
 
227
 
 
228
    def test_destroy_branch_default(self):
 
229
        """The default branch can be removed."""
 
230
        backing = self.get_transport()
 
231
        dir = self.make_branch('.').bzrdir
 
232
        request_class = smart_dir.SmartServerBzrDirRequestDestroyBranch
 
233
        request = request_class(backing)
 
234
        expected = smart_req.SuccessfulSmartServerResponse(('ok',))
 
235
        self.assertEqual(expected, request.execute('', None))
 
236
 
 
237
    def test_destroy_branch_named(self):
 
238
        """A named branch can be removed."""
 
239
        backing = self.get_transport()
 
240
        dir = self.make_repository('.', format="development-colo").bzrdir
 
241
        dir.create_branch(name="branchname")
 
242
        request_class = smart_dir.SmartServerBzrDirRequestDestroyBranch
 
243
        request = request_class(backing)
 
244
        expected = smart_req.SuccessfulSmartServerResponse(('ok',))
 
245
        self.assertEqual(expected, request.execute('', "branchname"))
 
246
 
 
247
    def test_destroy_branch_missing(self):
 
248
        """An error is raised if the branch didn't exist."""
 
249
        backing = self.get_transport()
 
250
        dir = self.make_bzrdir('.', format="development-colo")
 
251
        request_class = smart_dir.SmartServerBzrDirRequestDestroyBranch
 
252
        request = request_class(backing)
 
253
        expected = smart_req.FailedSmartServerResponse(('nobranch',), None)
 
254
        self.assertEqual(expected, request.execute('', "branchname"))
 
255
 
 
256
 
224
257
class TestSmartServerRequestCreateRepository(tests.TestCaseWithMemoryTransport):
225
258
    """Tests for BzrDir.create_repository."""
226
259