~bzr-pqm/bzr/bzr.dev

6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
1
# Copyright (C) 2010, 2011, 2012, 2016 Canonical Ltd
5227.1.3 by Andrew Bennetts
Add missing test file.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
17
"""Tests for branch.get_config behaviour."""
18
19
from bzrlib import (
20
    branch,
21
    errors,
22
    remote,
23
    tests,
24
    )
25
from bzrlib.tests import per_branch
26
27
28
class TestGetConfig(per_branch.TestCaseWithBranch):
29
30
    def test_set_user_option_with_dict(self):
31
        b = self.make_branch('b')
32
        config = b.get_config()
33
        value_dict = {
34
            'ascii': 'abcd', u'unicode \N{WATCH}': u'foo \N{INTERROBANG}'}
35
        config.set_user_option('name', value_dict.copy())
5549.1.26 by Vincent Ladeuil
At IRC request, rename interpolation to option expansion.
36
        self.assertEqual(value_dict, config.get_user_option('name'))
5227.1.3 by Andrew Bennetts
Add missing test file.
37
6531.2.1 by Vincent Ladeuil
Add a failing test and a brain-dead fix (duplicating the existing code).
38
    def test_set_submit_branch(self):
39
        # Make sure setting a config option persists on disk
40
        b = self.make_branch('.')
41
        b.set_submit_branch('foo')
42
        # Refresh the branch
43
        b = branch.Branch.open('.')
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
44
        self.assertEqual('foo', b.get_submit_branch())
6531.2.1 by Vincent Ladeuil
Add a failing test and a brain-dead fix (duplicating the existing code).
45
5227.1.3 by Andrew Bennetts
Add missing test file.
46