bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.171.1
by Robert Collins
Start working toward publish - get a publishing_root option |
1 |
# Copyright (C) 2005 by Canonical Ltd
|
2 |
# Authors: Robert Collins <robert.collins@canonical.com>
|
|
3 |
#
|
|
4 |
# This program is free software; you can redistribute it and/or modify
|
|
5 |
# it under the terms of the GNU General Public License as published by
|
|
6 |
# the Free Software Foundation; either version 2 of the License, or
|
|
7 |
# (at your option) any later version.
|
|
8 |
#
|
|
9 |
# This program is distributed in the hope that it will be useful,
|
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
# GNU General Public License for more details.
|
|
13 |
#
|
|
14 |
# You should have received a copy of the GNU General Public License
|
|
15 |
# along with this program; if not, write to the Free Software
|
|
16 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
17 |
||
18 |
from cStringIO import StringIO |
|
19 |
from unittest import TestLoader |
|
20 |
||
21 |
from bzrlib.branch import Branch |
|
22 |
import bzrlib.config as config |
|
23 |
from bzrlib.selftest import TestCase, TestCaseInTempDir |
|
24 |
from bzrlib.selftest.testconfig import FakeBranch |
|
25 |
||
26 |
||
27 |
def test_suite(): |
|
28 |
return TestLoader().loadTestsFromName(__name__) |
|
29 |
||
30 |
||
31 |
sample_config=("[DEFAULT]\n" |
|
|
0.171.2
by Robert Collins
publishing_product tied down |
32 |
"publishing_root=rsync://example.com/home/archives\n" |
33 |
"publishing_product=demo\n") |
|
34 |
||
35 |
||
36 |
sample_version_config=(sample_config + |
|
37 |
"publishing_version=0\n") |
|
|
0.171.1
by Robert Collins
Start working toward publish - get a publishing_root option |
38 |
|
39 |
||
40 |
class TestTest(TestCaseInTempDir): |
|
41 |
||
42 |
def test_get_publishing_root(self): |
|
|
0.171.2
by Robert Collins
publishing_product tied down |
43 |
my_config = self.get_config() |
44 |
self.assertEqual("rsync://example.com/home/archives", |
|
45 |
my_config.get_user_option("publishing_root")) |
|
46 |
||
47 |
def test_get_publising_product(self): |
|
48 |
my_config = self.get_config() |
|
49 |
self.assertEqual("demo", |
|
50 |
my_config.get_user_option("publishing_product")) |
|
51 |
||
52 |
# def test_get_publishing_version(self):
|
|
53 |
# my_config = self.get_config()
|
|
54 |
# self.assertEqual(None,
|
|
55 |
# my_config.get_user_option("publishing_version"))
|
|
56 |
#
|
|
57 |
# def test_get_present_publishing_version(self):
|
|
58 |
# my_config = self.get_config(sample_version_config)
|
|
59 |
# self.assertEqual('0',
|
|
60 |
# my_config.get_user_option("publishing_version"))
|
|
61 |
||
62 |
def get_config(self, text=sample_config): |
|
|
0.171.1
by Robert Collins
Start working toward publish - get a publishing_root option |
63 |
branch = FakeBranch() |
64 |
my_config = config.BranchConfig(branch) |
|
|
0.171.2
by Robert Collins
publishing_product tied down |
65 |
config_file = StringIO(text) |
|
0.171.1
by Robert Collins
Start working toward publish - get a publishing_root option |
66 |
(my_config._get_location_config(). |
67 |
_get_global_config()._get_parser(config_file)) |
|
|
0.171.2
by Robert Collins
publishing_product tied down |
68 |
return my_config |