1 # Copyright (C) 2007 Jelmer Vernooij <jelmer@samba.org>
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 from config import SvnRepositoryConfig
20 from scheme import TrunkBranchingScheme
22 from bzrlib.tests import TestCaseInTempDir
24 class ReposConfigTests(TestCaseInTempDir):
25 def test_create(self):
26 SvnRepositoryConfig("blabla")
28 def test_get_empty_locations(self):
29 c = SvnRepositoryConfig("blabla6")
30 self.assertEquals(set(), c.get_locations())
32 def test_get_location_one(self):
33 c = SvnRepositoryConfig("blabla5")
34 c.add_location("foobar")
35 self.assertEquals(set(["foobar"]), c.get_locations())
37 def test_get_location_two(self):
38 c = SvnRepositoryConfig("blabla4")
39 c.add_location("foobar")
40 c.add_location("brainslug")
41 self.assertEquals(set(["foobar", "brainslug"]), c.get_locations())
43 def test_get_scheme_none(self):
44 c = SvnRepositoryConfig("blabla3")
45 self.assertEquals(None, c.get_branching_scheme())
47 def test_get_scheme_set(self):
48 c = SvnRepositoryConfig("blabla2")
49 c.set_branching_scheme(TrunkBranchingScheme())
50 self.assertEquals("trunk0", str(c.get_branching_scheme()))
52 def test_get_scheme_mandatory_none(self):
53 c = SvnRepositoryConfig("blabla3")
54 self.assertEquals(False, c.branching_scheme_is_mandatory())
56 def test_get_scheme_mandatory_set(self):
57 c = SvnRepositoryConfig("blabla3")
58 c.set_branching_scheme(TrunkBranchingScheme(), mandatory=True)
59 self.assertEquals(True, c.branching_scheme_is_mandatory())
61 def test_override_revprops(self):
62 c = SvnRepositoryConfig("blabla2")
63 self.assertEquals(None, c.get_override_svn_revprops())
64 c.set_user_option("override-svn-revprops", "True")
65 self.assertEquals(True, c.get_override_svn_revprops())
66 c.set_user_option("override-svn-revprops", "False")
67 self.assertEquals(False, c.get_override_svn_revprops())
69 def test_set_revprops(self):
70 c = SvnRepositoryConfig("blabla2")
71 self.assertEquals(None, c.get_set_revprops())
72 c.set_user_option("set-revprops", "True")
73 self.assertEquals(True, c.get_set_revprops())
74 c.set_user_option("set-revprops", "False")
75 self.assertEquals(False, c.get_set_revprops())
77 def test_supports_change_revprop(self):
78 c = SvnRepositoryConfig("blabla2")
79 self.assertEquals(None, c.get_supports_change_revprop())
80 c.set_user_option("supports-change-revprop", "True")
81 self.assertEquals(True, c.get_supports_change_revprop())
82 c.set_user_option("supports-change-revprop", "False")
83 self.assertEquals(False, c.get_supports_change_revprop())