/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
1752.2.30 by Martin Pool
Start adding a RemoteBzrDir, etc
1
# Copyright (C) 2006 Canonical Ltd
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
17
"""Tests for remote bzrdir/branch/repo/etc
18
19
These are proxy objects which act on remote objects by sending messages
20
through a smart client.  The proxies are to be created when attempting to open
21
the object given a transport that supports smartserver rpc operations. 
22
"""
23
24
from bzrlib import bzrdir, remote, tests
2018.5.20 by Andrew Bennetts
Move bzrlib/transport/smart/_smart.py to bzrlib/transport/remote.py and rename SmartTransport to RemoteTransport (Robert Collins, Andrew Bennetts)
25
from bzrlib.transport import remote as remote_transport
2018.5.21 by Andrew Bennetts
Move bzrlib.transport.smart to bzrlib.smart
26
from bzrlib import smart
27
from bzrlib.smart import server
1752.2.30 by Martin Pool
Start adding a RemoteBzrDir, etc
28
from bzrlib.bzrdir import BzrDir, BzrDirFormat
29
from bzrlib.remote import RemoteBzrDir, RemoteBzrDirFormat
30
from bzrlib.branch import Branch
31
2018.5.24 by Andrew Bennetts
Setting NO_SMART_VFS in environment will disable VFS methods in the smart server. (Robert Collins, John Arbash Meinel, Andrew Bennetts)
32
1752.2.30 by Martin Pool
Start adding a RemoteBzrDir, etc
33
class BasicRemoteObjectTests(tests.TestCaseInTempDir):
34
35
    def setUp(self):
36
        tests.TestCaseInTempDir.setUp(self)
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
37
        self.server = server.SmartTCPServer_for_testing()
1752.2.30 by Martin Pool
Start adding a RemoteBzrDir, etc
38
        self.server.setUp()
39
        self.addCleanup(self.server.tearDown)
2018.5.20 by Andrew Bennetts
Move bzrlib/transport/smart/_smart.py to bzrlib/transport/remote.py and rename SmartTransport to RemoteTransport (Robert Collins, Andrew Bennetts)
40
        self.transport = remote_transport.SmartTCPTransport(self.server.get_url())
1752.2.30 by Martin Pool
Start adding a RemoteBzrDir, etc
41
        self.client = self.transport.get_smart_client()
42
        # make a branch that can be opened over the smart transport
1752.2.31 by Martin Pool
[broken] some support for write operations over hpss
43
        self.local_wt = BzrDir.create_standalone_workingtree('.')
1752.2.30 by Martin Pool
Start adding a RemoteBzrDir, etc
44
45
    def test_create_remote_bzrdir(self):
46
        b = remote.RemoteBzrDir(self.transport)
47
        self.assertIsInstance(b, BzrDir)
48
49
    def test_open_remote_branch(self):
50
        # create a standalone branch in the working directory
51
        b = remote.RemoteBzrDir(self.transport)
52
        branch = b.open_branch()
53
1752.2.31 by Martin Pool
[broken] some support for write operations over hpss
54
    def test_remote_repository(self):
55
        b = BzrDir.open_from_transport(self.transport)
56
        repo = b.open_repository()
57
        self.assertFalse(repo.has_revision('23123123'))
58
        self.local_wt.commit(message='test commit', 
59
                             rev_id='rev-1',
60
                             allow_pointless=True)
61
        self.assertTrue(repo.has_revision('rev-1'))
62
63
    def test_remote_branch_revision_history(self):
64
        b = BzrDir.open_from_transport(self.transport).open_branch()
65
        rh = b.revision_history()
66
        self.assertEqual(len(rh), 0)
67
1752.2.30 by Martin Pool
Start adding a RemoteBzrDir, etc
68
    def test_find_correct_format(self):
2018.5.20 by Andrew Bennetts
Move bzrlib/transport/smart/_smart.py to bzrlib/transport/remote.py and rename SmartTransport to RemoteTransport (Robert Collins, Andrew Bennetts)
69
        """Should open a RemoteBzrDir over a RemoteTransport"""
1752.2.30 by Martin Pool
Start adding a RemoteBzrDir, etc
70
        fmt = BzrDirFormat.find_format(self.transport)
71
        ## self.assert_(RemoteBzrDirFormat in BzrDirFormat._control_formats)
72
        self.assertIsInstance(fmt, remote.RemoteBzrDirFormat)
73
74
    def test_open_detected_smart_format(self):
75
        fmt = BzrDirFormat.find_format(self.transport)
76
        d = fmt.open(self.transport)
77
        self.assertIsInstance(d, BzrDir)