/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
19
from bzrlib.tests.blackbox import ExternalBase
20
21
from bzrlib.plugins.git import (
22
    ids,
23
    tests,
24
    )
25
26
27
class TestGitBlackBox(ExternalBase):
28
0.200.76 by Jelmer Vernooij
Add blackbox test for info -v
29
    def simple_commit(self):
30
        # Create a git repository with a revision.
31
        tests.run_git('init')
32
        builder = tests.GitBranchBuilder()
33
        builder.set_file('a', 'text for a\n', False)
34
        builder.commit('Joe Foo <joe@foo.com>', u'<The commit message>')
35
        builder.finish()
36
0.200.68 by Jelmer Vernooij
Add blackbox test for info.
37
    def test_info(self):
0.200.76 by Jelmer Vernooij
Add blackbox test for info -v
38
        self.simple_commit()
0.200.68 by Jelmer Vernooij
Add blackbox test for info.
39
        output, error = self.run_bzr(['info'])
40
        self.assertEqual(error, '')
41
        self.assertTrue("Repository branch (format: git)" in output)
42
0.200.78 by Jelmer Vernooij
Add blackbox test for ls.
43
    def test_ls(self):
44
        self.simple_commit()
45
        output, error = self.run_bzr(['ls'])
46
        self.assertEqual(error, '')
47
        self.assertEqual(output, "a\n")
48
0.200.76 by Jelmer Vernooij
Add blackbox test for info -v
49
    def test_info_verbose(self):
50
        self.simple_commit()
51
52
        output, error = self.run_bzr(['info', '-v'])
53
        self.assertEqual(error, '')
54
        self.assertTrue("Repository branch (format: git)" in output)
55
        self.assertTrue("control: Local Git Repository" in output)
56
        self.assertTrue("branch: Git Branch" in output)
57
        self.assertTrue("repository: Git Repository" in output)
58
0.200.39 by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree.
59
    def test_log(self):
60
        # Smoke test for "bzr log" in a git repository.
0.200.76 by Jelmer Vernooij
Add blackbox test for info -v
61
        self.simple_commit()
0.200.39 by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree.
62
63
        # Check that bzr log does not fail and includes the revision.
64
        output, error = self.run_bzr(['log'])
65
        self.assertEqual(error, '')
66
        self.assertTrue(
67
            '<The commit message>' in output,
68
            "Commit message was not found in output:\n%s" % (output,))
0.200.80 by Jelmer Vernooij
Add blackbox test for bzr log -v.
69
70
    def test_log_verbose(self):
71
        # Smoke test for "bzr log -v" in a git repository.
72
        self.simple_commit()
73
74
        # Check that bzr log does not fail and includes the revision.
75
        output, error = self.run_bzr(['log', '-v'])
76