~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2011 Canonical Ltd
 
1
# Copyright (C) 2006-2012 Canonical Ltd
2
2
# Authors: Aaron Bentley
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
193
193
 
194
194
    def test_mailto_option(self):
195
195
        b = branch.Branch.open('branch')
196
 
        b.get_config().set_user_option('mail_client', 'editor')
 
196
        b.get_config_stack().set('mail_client', 'editor')
197
197
        self.run_bzr_error(
198
198
            ('No mail-to address \\(--mail-to\\) or output \\(-o\\) specified',
199
199
            ), 'send -f branch')
200
 
        b.get_config().set_user_option('mail_client', 'bogus')
 
200
        b.get_config_stack().set('mail_client', 'bogus')
201
201
        self.run_send([])
202
 
        self.run_bzr_error(('Unknown mail client: bogus',),
 
202
        self.run_bzr_error(('Bad value "bogus" for option "mail_client"',),
203
203
                           'send -f branch --mail-to jrandom@example.org')
204
204
        b.get_config_stack().set('submit_to', 'jrandom@example.org')
205
 
        self.run_bzr_error(('Unknown mail client: bogus',),
 
205
        self.run_bzr_error(('Bad value "bogus" for option "mail_client"',),
206
206
                           'send -f branch')
207
207
 
208
208
    def test_mailto_child_option(self):
209
209
        """Make sure that child_submit_to is used."""
210
210
        b = branch.Branch.open('branch')
211
 
        b.get_config().set_user_option('mail_client', 'bogus')
 
211
        b.get_config_stack().set('mail_client', 'bogus')
212
212
        parent = branch.Branch.open('parent')
213
213
        parent.get_config_stack().set('child_submit_to', 'somebody@example.org')
214
 
        self.run_bzr_error(('Unknown mail client: bogus',), 'send -f branch')
 
214
        self.run_bzr_error(('Bad value "bogus" for option "mail_client"',),
 
215
                'send -f branch')
215
216
 
216
217
    def test_format(self):
217
218
        md = self.get_MD(['--format=4'])
229
230
                            'send -f branch -o- --format=0.999')[0]
230
231
 
231
232
    def test_format_child_option(self):
232
 
        parent_config = branch.Branch.open('parent').get_config_stack()
233
 
        parent_config.set('child_submit_format', '4')
 
233
        br = branch.Branch.open('parent')
 
234
        conf = br.get_config_stack()
 
235
        conf.set('child_submit_format', '4')
234
236
        md = self.get_MD([])
235
237
        self.assertIs(merge_directive.MergeDirective2, md.__class__)
236
238
 
237
 
        parent_config.set('child_submit_format', '0.9')
 
239
        conf.set('child_submit_format', '0.9')
238
240
        md = self.get_MD([])
239
241
        self.assertFormatIs('# Bazaar revision bundle v0.9', md)
240
242
 
242
244
        self.assertFormatIs('# Bazaar revision bundle v0.9', md)
243
245
        self.assertIs(merge_directive.MergeDirective, md.__class__)
244
246
 
245
 
        parent_config.set('child_submit_format', '0.999')
 
247
        conf.set('child_submit_format', '0.999')
246
248
        self.run_bzr_error(["No such send format '0.999'"],
247
249
                            'send -f branch -o-')[0]
248
250
 
292
294
    _default_additional_warning = 'Uncommitted changes will not be sent.'
293
295
 
294
296
    def set_config_send_strict(self, value):
295
 
        # set config var (any of bazaar.conf, locations.conf, branch.conf
296
 
        # should do)
297
 
        conf = self.local_tree.branch.get_config_stack()
298
 
        conf.set('send_strict', value)
 
297
        br = branch.Branch.open('local')
 
298
        br.get_config_stack().set('send_strict', value)
299
299
 
300
300
    def assertSendFails(self, args):
301
301
        out, err = self.run_send(args, rc=3, err_re=self._default_errors)
462
462
        # being too low. If rpc_count increases, more network roundtrips have
463
463
        # become necessary for this use case. Please do not adjust this number
464
464
        # upwards without agreement from bzr's network support maintainers.
465
 
        self.assertLength(9, self.hpss_calls)
 
465
        self.assertLength(7, self.hpss_calls)
466
466
        self.assertLength(1, self.hpss_connections)
467
467
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)