~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_serve.py

Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
        self.assertEqual('', result[0])
58
58
        self.assertEqual('bzr: interrupted\n', result[1])
59
59
 
 
60
    def make_read_requests(self, branch):
 
61
        """Do some read only requests."""
 
62
        branch.lock_read()
 
63
        try:
 
64
            branch.repository.all_revision_ids()
 
65
            self.assertEqual(_mod_revision.NULL_REVISION,
 
66
                             _mod_revision.ensure_null(branch.last_revision()))
 
67
        finally:
 
68
            branch.unlock()
 
69
 
60
70
    def start_server_inet(self, extra_options=()):
61
71
        """Start a bzr server subprocess using the --inet option.
62
72
 
107
117
 
108
118
        # We get a working branch
109
119
        branch = BzrDir.open_from_transport(transport).open_branch()
110
 
        branch.repository.get_revision_graph()
111
 
        self.assertEqual(_mod_revision.NULL_REVISION,
112
 
                         _mod_revision.ensure_null(branch.last_revision()))
 
120
        self.make_read_requests(branch)
113
121
        self.assertInetServerShutsdownCleanly(process)
114
122
 
115
123
    def test_bzr_serve_port_readonly(self):
127
135
 
128
136
        # Connect to the server
129
137
        branch = Branch.open(url)
130
 
 
131
 
        # We get a working branch
132
 
        branch.repository.get_revision_graph()
133
 
        self.assertEqual(_mod_revision.NULL_REVISION,
134
 
                         _mod_revision.ensure_null(branch.last_revision()))
135
 
 
 
138
        self.make_read_requests(branch)
136
139
        self.assertServerFinishesCleanly(process)
137
140
 
138
141
    def test_bzr_connect_to_bzr_ssh(self):
208
211
                path_to_branch = os.path.splitdrive(path_to_branch)[1]
209
212
            branch = Branch.open(
210
213
                'bzr+ssh://fred:secret@localhost:%d%s' % (port, path_to_branch))
211
 
            
212
 
            branch.repository.get_revision_graph()
213
 
            self.assertEqual(_mod_revision.NULL_REVISION,
214
 
                             _mod_revision.ensure_null(branch.last_revision()))
 
214
            self.make_read_requests(branch)
215
215
            # Check we can perform write operations
216
216
            branch.bzrdir.root_transport.mkdir('foo')
217
217
        finally: