/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
0.200.39 by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree.
1
# Copyright (C) 2007 David Allouche <ddaa@ddaa.net>
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
17
"""Black-box tests for bzr-git."""
18
0.200.85 by Jelmer Vernooij
Add test for creating new tags.
19
from bzrlib.tests import KnownFailure
0.200.39 by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree.
20
from bzrlib.tests.blackbox import ExternalBase
21
22
from bzrlib.plugins.git import (
23
    ids,
24
    tests,
25
    )
26
27
28
class TestGitBlackBox(ExternalBase):
29
0.200.76 by Jelmer Vernooij
Add blackbox test for info -v
30
    def simple_commit(self):
31
        # Create a git repository with a revision.
32
        tests.run_git('init')
33
        builder = tests.GitBranchBuilder()
34
        builder.set_file('a', 'text for a\n', False)
35
        builder.commit('Joe Foo <joe@foo.com>', u'<The commit message>')
36
        builder.finish()
37
0.200.68 by Jelmer Vernooij
Add blackbox test for info.
38
    def test_info(self):
0.200.76 by Jelmer Vernooij
Add blackbox test for info -v
39
        self.simple_commit()
0.200.68 by Jelmer Vernooij
Add blackbox test for info.
40
        output, error = self.run_bzr(['info'])
41
        self.assertEqual(error, '')
42
        self.assertTrue("Repository branch (format: git)" in output)
43
0.200.78 by Jelmer Vernooij
Add blackbox test for ls.
44
    def test_ls(self):
45
        self.simple_commit()
46
        output, error = self.run_bzr(['ls'])
47
        self.assertEqual(error, '')
48
        self.assertEqual(output, "a\n")
49
0.200.76 by Jelmer Vernooij
Add blackbox test for info -v
50
    def test_info_verbose(self):
51
        self.simple_commit()
52
53
        output, error = self.run_bzr(['info', '-v'])
54
        self.assertEqual(error, '')
55
        self.assertTrue("Repository branch (format: git)" in output)
56
        self.assertTrue("control: Local Git Repository" in output)
57
        self.assertTrue("branch: Git Branch" in output)
58
        self.assertTrue("repository: Git Repository" in output)
59
0.200.39 by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree.
60
    def test_log(self):
61
        # Smoke test for "bzr log" in a git repository.
0.200.76 by Jelmer Vernooij
Add blackbox test for info -v
62
        self.simple_commit()
0.200.39 by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree.
63
64
        # Check that bzr log does not fail and includes the revision.
65
        output, error = self.run_bzr(['log'])
66
        self.assertEqual(error, '')
67
        self.assertTrue(
68
            '<The commit message>' in output,
69
            "Commit message was not found in output:\n%s" % (output,))
0.200.80 by Jelmer Vernooij
Add blackbox test for bzr log -v.
70
71
    def test_log_verbose(self):
72
        # Smoke test for "bzr log -v" in a git repository.
73
        self.simple_commit()
74
75
        # Check that bzr log does not fail and includes the revision.
76
        output, error = self.run_bzr(['log', '-v'])
77
 
0.200.83 by Jelmer Vernooij
Add blackbox test for 'bzr tags'
78
    def test_tags(self):
79
        self.simple_commit()
80
81
        tests.run_git("tag", "foo")
82
83
        output, error = self.run_bzr(['tags'])
84
        self.assertEquals(error, '')
85
        self.assertEquals(output, "foo                  1\n")
86
0.200.85 by Jelmer Vernooij
Add test for creating new tags.
87
    def test_tag(self):
88
        raise KnownFailure("setting tags not supported by git-python yet")
89
        self.simple_commit()
90
91
        output, error = self.run_bzr(["tag", "bar"])
92
93
        self.assertEquals(error, '')
94
        self.assertEquals(output, '')
95