/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to tests/test_blackbox.py

Fix RevisionTree.get_file_text().

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Black-box tests for bzr-git."""
18
18
 
 
19
from bzrlib.tests import KnownFailure
19
20
from bzrlib.tests.blackbox import ExternalBase
20
21
 
21
22
from bzrlib.plugins.git import (
26
27
 
27
28
class TestGitBlackBox(ExternalBase):
28
29
 
 
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
 
29
38
    def test_info(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
 
 
 
39
        self.simple_commit()
37
40
        output, error = self.run_bzr(['info'])
38
41
        self.assertEqual(error, '')
39
42
        self.assertTrue("Repository branch (format: git)" in output)
40
43
 
 
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
 
 
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
 
41
60
    def test_log(self):
42
61
        # Smoke test for "bzr log" in a git repository.
43
 
 
44
 
        # Create a git repository with a revision.
45
 
        tests.run_git('init')
46
 
        builder = tests.GitBranchBuilder()
47
 
        builder.set_file('a', 'text for a\n', False)
48
 
        builder.commit('Joe Foo <joe@foo.com>', u'<The commit message>')
49
 
        builder.finish()
 
62
        self.simple_commit()
50
63
 
51
64
        # Check that bzr log does not fail and includes the revision.
52
65
        output, error = self.run_bzr(['log'])
54
67
        self.assertTrue(
55
68
            '<The commit message>' in output,
56
69
            "Commit message was not found in output:\n%s" % (output,))
 
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
 
 
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
 
 
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