~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart.py

  • Committer: Patch Queue Manager
  • Date: 2012-01-23 15:31:35 UTC
  • mfrom: (6443.1.1 bzr.dev)
  • Revision ID: pqm@pqm.ubuntu.com-20120123153135-8v3r3z1lx055vmpl
(jelmer) Merge the 2.5 series branch. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
import zlib
29
29
 
30
30
from bzrlib import (
 
31
    bencode,
31
32
    branch as _mod_branch,
32
33
    bzrdir,
33
34
    errors,
458
459
        self.assertEqual(expected, request.execute(''))
459
460
 
460
461
 
 
462
class TestSmartServerBzrDirRequestGetBranches(
 
463
    tests.TestCaseWithMemoryTransport):
 
464
    """Tests for BzrDir.get_branches."""
 
465
 
 
466
    def test_simple(self):
 
467
        backing = self.get_transport()
 
468
        branch = self.make_branch('.')
 
469
        request_class = smart_dir.SmartServerBzrDirRequestGetBranches
 
470
        request = request_class(backing)
 
471
        local_result = bencode.bencode(
 
472
            {"": ("branch", branch._format.network_name())})
 
473
        expected = smart_req.SuccessfulSmartServerResponse(
 
474
            ("success", ), local_result)
 
475
        self.assertEqual(expected, request.execute(''))
 
476
 
 
477
    def test_empty(self):
 
478
        backing = self.get_transport()
 
479
        dir = self.make_bzrdir('.')
 
480
        request_class = smart_dir.SmartServerBzrDirRequestGetBranches
 
481
        request = request_class(backing)
 
482
        local_result = bencode.bencode({})
 
483
        expected = smart_req.SuccessfulSmartServerResponse(
 
484
            ('success',), local_result)
 
485
        self.assertEqual(expected, request.execute(''))
 
486
 
 
487
 
461
488
class TestSmartServerRequestInitializeBzrDir(tests.TestCaseWithMemoryTransport):
462
489
 
463
490
    def test_empty_dir(self):
485
512
        backing = self.get_transport()
486
513
        request = smart_dir.SmartServerRequestInitializeBzrDir(backing)
487
514
        self.make_bzrdir('subdir')
488
 
        self.assertRaises(errors.FileExists,
 
515
        self.assertRaises(errors.AlreadyControlDirError,
489
516
            request.execute, 'subdir')
490
517
 
491
518
 
2500
2527
            smart_dir.SmartServerBzrDirRequestCheckoutMetaDir)
2501
2528
        self.assertHandlerEqual('BzrDir.cloning_metadir',
2502
2529
            smart_dir.SmartServerBzrDirRequestCloningMetaDir)
 
2530
        self.assertHandlerEqual('BzrDir.get_branches',
 
2531
            smart_dir.SmartServerBzrDirRequestGetBranches)
2503
2532
        self.assertHandlerEqual('BzrDir.get_config_file',
2504
2533
            smart_dir.SmartServerBzrDirRequestConfigFile)
2505
2534
        self.assertHandlerEqual('BzrDir.open_branch',