~ubuntu-branches/ubuntu/raring/bzr-svn/raring

« back to all changes in this revision

Viewing changes to tests/layout/test_custom.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2010-07-30 23:14:36 UTC
  • mfrom: (1.1.28 upstream) (3.3.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100730231436-po8j0ibgjn2d6hy0
Tags: 1.0.3-1
* New upstream release.
 + Provides BranchConfig._get_change_editor. Closes: #572109
 + Supports more trunk layout levels. Closes: #573988
* Bump standards version to 3.9.1.
* Mark as supporting bzr 2.2.
* Suggest bzr-rewrite rather than bzr-rebase. LP: #481730

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2005-2009 Jelmer Vernooij <jelmer@samba.org>
 
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, see <http://www.gnu.org/licenses/>.
 
15
 
 
16
from bzrlib.tests import (
 
17
    TestCase,
 
18
    )
 
19
 
 
20
from bzrlib.plugins.svn import errors as svn_errors
 
21
 
 
22
from bzrlib.plugins.svn.layout.custom import (
 
23
    KDELayout,
 
24
    )
 
25
 
 
26
 
 
27
class KDELayoutTests(TestCase):
 
28
 
 
29
    def setUp(self):
 
30
        TestCase.setUp(self)
 
31
        self.layout = KDELayout()
 
32
 
 
33
    def test_repr(self):
 
34
        self.assertEquals("KDELayout()", repr(self.layout))
 
35
 
 
36
    def test_str(self):
 
37
        self.assertEquals("kde", str(self.layout))
 
38
 
 
39
    def test_get_project_prefixes(self):
 
40
        self.assertEquals([
 
41
            "trunk/KDE/kdebase",
 
42
            "branches/KDE",
 
43
            "tags/KDE"], self.layout.get_project_prefixes("KDE/kdebase"))
 
44
 
 
45
    def test_get_path(self):
 
46
        self.assertEquals("tags/KDE/1.0/kdebase", 
 
47
            self.layout.get_tag_path("1.0", "KDE/kdebase"))
 
48
        self.assertEquals("tags/k3b/3.0",
 
49
            self.layout.get_tag_path("3.0", "k3b"))
 
50
 
 
51
    def test_is_branch_parent(self):
 
52
        self.assertTrue(self.layout.is_branch_parent(""))
 
53
        self.assertTrue(self.layout.is_branch_parent("trunk"))
 
54
        self.assertTrue(self.layout.is_branch_parent("trunk/KDE"))
 
55
        self.assertTrue(self.layout.is_branch_parent("branches"))
 
56
        self.assertTrue(self.layout.is_branch_parent("branches/KDE/2.0"))
 
57
        self.assertFalse(self.layout.is_branch_parent("branches/something/2.0"))
 
58
        self.assertTrue(self.layout.is_branch_parent("branches/KDE"))
 
59
        self.assertFalse(self.layout.is_branch_parent("branches/some"))
 
60
 
 
61
    def test_parse(self):
 
62
        self.assertRaises(svn_errors.NotSvnBranchPath, 
 
63
            self.layout.parse, "branches")
 
64
        self.assertRaises(svn_errors.NotSvnBranchPath, 
 
65
            self.layout.parse, "tags")
 
66
        self.assertRaises(svn_errors.NotSvnBranchPath, 
 
67
            self.layout.parse, "trunk")
 
68
        self.assertRaises(svn_errors.NotSvnBranchPath, 
 
69
            self.layout.parse, "branches/2.0")
 
70
        self.assertRaises(svn_errors.NotSvnBranchPath, 
 
71
            self.layout.parse, "branches/KDE/2.0")
 
72
 
 
73
    def test_parse_kdebase(self):
 
74
        self.assertEquals(("branch", "KDE/kdebase", "trunk/KDE/kdebase", ""),
 
75
            self.layout.parse("trunk/KDE/kdebase"))
 
76
        self.assertEquals(("branch", "KDE/kdebase", "branches/KDE/2.0/kdebase", ""),
 
77
            self.layout.parse("branches/KDE/2.0/kdebase"))
 
78
        self.assertEquals(("branch", "KDE/kdebase", "branches/KDE/2.0/kdebase", "foo"),
 
79
            self.layout.parse("branches/KDE/2.0/kdebase/foo"))
 
80
 
 
81
    def test_get_tag_name(self):
 
82
        self.assertEquals("mytag", self.layout.get_tag_name("tags/KDE/mytag/foo"))
 
83
        self.assertEquals("bla", self.layout.get_tag_name("tags/k3b/bla"))