/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
6779.1.3 by Jelmer Vernooij
Add some basic tests for repodebug.
1
# Copyright (C) 2017 by Jelmer Vernooij
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
import sys
18
from unittest import TestLoader, TestSuite
19
20
from breezy.tests import TestCaseWithTransport
21
22
23
class SmokeTests(TestCaseWithTransport):
24
25
    def test_check_chk(self):
26
        out, err = self.run_bzr('check-chk')
7027.4.2 by Jelmer Vernooij
Use StringIOWithEncoding in run_bzr.
27
        self.assertEqual(out, '')
28
        self.assertEqual(err, '')
6779.1.3 by Jelmer Vernooij
Add some basic tests for repodebug.
29
30
    def test_chk_used_by(self):
31
        self.make_branch_and_tree('.')
32
        out, err = self.run_bzr('chk-used-by chk')
7027.4.2 by Jelmer Vernooij
Use StringIOWithEncoding in run_bzr.
33
        self.assertEqual(out, '')
34
        self.assertEqual(err, '')
6779.1.3 by Jelmer Vernooij
Add some basic tests for repodebug.
35
36
    def test_fetch_all_records(self):
37
        self.make_branch_and_tree('source')
38
        self.make_branch_and_tree('dest')
39
        out, err = self.run_bzr('fetch-all-records source -d dest')
7027.4.2 by Jelmer Vernooij
Use StringIOWithEncoding in run_bzr.
40
        self.assertEqual(out, 'Done.\n')
41
        self.assertEqual(err, '')
6779.1.3 by Jelmer Vernooij
Add some basic tests for repodebug.
42
43
    def test_file_refs(self):
44
        tree = self.make_branch_and_tree('.')
45
        self.build_tree(['foo'])
46
        tree.add('foo')
47
        revid = tree.commit('a commit')
48
        out, err = self.run_bzr(
7143.15.2 by Jelmer Vernooij
Run autopep8.
49
            'file-refs ' + tree.path2id('foo').decode() + ' ' + revid.decode())
7027.4.2 by Jelmer Vernooij
Use StringIOWithEncoding in run_bzr.
50
        self.assertEqual(out, revid.decode('utf-8') + '\n')
51
        self.assertEqual(err, '')
6779.1.3 by Jelmer Vernooij
Add some basic tests for repodebug.
52
53
    def test_fix_missing_keys_for_stacking(self):
54
        self.make_branch_and_tree('stacked')
55
        self.run_bzr('branch --stacked stacked new')
56
        out, err = self.run_bzr('fix-missing-keys-for-stacking new')
7027.4.2 by Jelmer Vernooij
Use StringIOWithEncoding in run_bzr.
57
        self.assertEqual(out, '')
58
        self.assertEqual(err, '')
6779.1.3 by Jelmer Vernooij
Add some basic tests for repodebug.
59
60
    def test_mirror_revs_into(self):
61
        self.make_branch_and_tree('source')
62
        self.make_branch_and_tree('dest')
63
        out, err = self.run_bzr('mirror-revs-into source dest')
7027.4.2 by Jelmer Vernooij
Use StringIOWithEncoding in run_bzr.
64
        self.assertEqual(out, '')
65
        self.assertEqual(err, '')
6779.1.3 by Jelmer Vernooij
Add some basic tests for repodebug.
66
67
    def test_repo_has_key(self):
68
        self.make_branch_and_tree('repo')
69
        out, err = self.run_bzr('repo-has-key repo revisions revid', retcode=1)
7027.4.2 by Jelmer Vernooij
Use StringIOWithEncoding in run_bzr.
70
        self.assertEqual(out, 'False\n')
71
        self.assertEqual(err, '')
6779.1.3 by Jelmer Vernooij
Add some basic tests for repodebug.
72
73
    def test_repo_keys(self):
74
        self.make_branch_and_tree('a')
75
        out, err = self.run_bzr('repo-keys a texts')
7027.4.2 by Jelmer Vernooij
Use StringIOWithEncoding in run_bzr.
76
        self.assertEqual(out, '')
77
        self.assertEqual(err, '')
6779.1.3 by Jelmer Vernooij
Add some basic tests for repodebug.
78
79
80
def test_suite():
81
    result = TestSuite()
82
83
    loader = TestLoader()
84
    result.addTests(loader.loadTestsFromModule(sys.modules[__name__]))
85
    return result