~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Aaron Bentley
  • Date: 2007-12-25 04:17:50 UTC
  • mto: This revision was merged to the branch mainline in revision 3160.
  • Revision ID: aaron.bentley@utoronto.ca-20071225041750-t6chr3pmgnebvqcz
Handle non-directory parent conflicts (abentley, #177390)

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
 
 
70
60
    def start_server_inet(self, extra_options=()):
71
61
        """Start a bzr server subprocess using the --inet option.
72
62
 
80
70
        # Connect to the server
81
71
        # We use this url because while this is no valid URL to connect to this
82
72
        # server instance, the transport needs a URL.
83
 
        url = 'bzr://localhost/'
84
73
        client_medium = medium.SmartSimplePipesClientMedium(
85
 
            process.stdout, process.stdin, url)
86
 
        transport = remote.RemoteTransport(url, medium=client_medium)
 
74
            process.stdout, process.stdin)
 
75
        transport = remote.RemoteTransport(
 
76
            'bzr://localhost/', medium=client_medium)
87
77
        return process, transport
88
78
 
89
79
    def start_server_port(self, extra_options=()):
117
107
 
118
108
        # We get a working branch
119
109
        branch = BzrDir.open_from_transport(transport).open_branch()
120
 
        self.make_read_requests(branch)
 
110
        branch.repository.get_revision_graph()
 
111
        self.assertEqual(_mod_revision.NULL_REVISION,
 
112
                         _mod_revision.ensure_null(branch.last_revision()))
121
113
        self.assertInetServerShutsdownCleanly(process)
122
114
 
123
115
    def test_bzr_serve_port_readonly(self):
135
127
 
136
128
        # Connect to the server
137
129
        branch = Branch.open(url)
138
 
        self.make_read_requests(branch)
 
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
 
139
136
        self.assertServerFinishesCleanly(process)
140
137
 
141
138
    def test_bzr_connect_to_bzr_ssh(self):
211
208
                path_to_branch = os.path.splitdrive(path_to_branch)[1]
212
209
            branch = Branch.open(
213
210
                'bzr+ssh://fred:secret@localhost:%d%s' % (port, path_to_branch))
214
 
            self.make_read_requests(branch)
 
211
            
 
212
            branch.repository.get_revision_graph()
 
213
            self.assertEqual(_mod_revision.NULL_REVISION,
 
214
                             _mod_revision.ensure_null(branch.last_revision()))
215
215
            # Check we can perform write operations
216
216
            branch.bzrdir.root_transport.mkdir('foo')
217
217
        finally: