bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
2929.2.2
by Robert Collins
Review feedback on dirstate update_basis_via_delta logic. |
1 |
# Copyright (C) 2007 Canonical Ltd
|
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 |
"""Tests for the 'check' CLI command."""
|
|
18 |
||
|
3015.4.15
by Daniel Watkins
Added test cases for missing objects. |
19 |
from bzrlib.tests import ChrootedTestCase |
|
2929.2.2
by Robert Collins
Review feedback on dirstate update_basis_via_delta logic. |
20 |
from bzrlib.tests.blackbox import ExternalBase |
21 |
||
22 |
||
23 |
class TestCheck(ExternalBase): |
|
24 |
||
25 |
def test_check_no_tree(self): |
|
|
2929.2.3
by Robert Collins
Review feedback. |
26 |
self.make_branch('.') |
27 |
self.run_bzr('check') |
|
28 |
||
29 |
def test_check_initial_tree(self): |
|
30 |
self.make_branch_and_tree('.') |
|
31 |
self.run_bzr('check') |
|
32 |
||
33 |
def test_check_one_commit_tree(self): |
|
34 |
tree = self.make_branch_and_tree('.') |
|
35 |
tree.commit('hallelujah') |
|
|
3015.4.6
by Daniel Watkins
Modified test to ensure that check with no arguments check everything. |
36 |
out, err = self.run_bzr('check') |
37 |
self.assertContainsRe(err, r"^Checking working tree at '.*'\.\n" |
|
38 |
r"Checking repository at '.*'\.\n" |
|
39 |
r"checked repository.*\n" |
|
40 |
r" 1 revisions\n" |
|
41 |
r" 0 file-ids\n" |
|
42 |
r" 0 unique file texts\n" |
|
43 |
r" 0 repeated file texts\n" |
|
44 |
r" 0 unreferenced text versions\n" |
|
45 |
r"Checking branch at '.*'\.\n" |
|
46 |
r"checked branch.*\n$") |
|
|
3015.4.1
by Daniel Watkins
Added tests for new command line options. |
47 |
|
48 |
def test_check_branch(self): |
|
49 |
tree = self.make_branch_and_tree('.') |
|
50 |
tree.commit('foo') |
|
51 |
out, err = self.run_bzr('check --branch') |
|
52 |
self.assertContainsRe(err, r"^Checking branch at '.*'\.\n" |
|
53 |
r"checked branch.*\n$") |
|
54 |
||
55 |
def test_check_repository(self): |
|
56 |
tree = self.make_branch_and_tree('.') |
|
57 |
tree.commit('foo') |
|
58 |
out, err = self.run_bzr('check --repo') |
|
|
3015.4.4
by Daniel Watkins
Strengthened tests. |
59 |
self.assertContainsRe(err, r"^Checking repository at '.*'\.\n" |
60 |
r"checked repository.*\n" |
|
61 |
r" 1 revisions\n" |
|
62 |
r" 0 file-ids\n" |
|
63 |
r" 0 unique file texts\n" |
|
64 |
r" 0 repeated file texts\n" |
|
65 |
r" 0 unreferenced text versions$") |
|
|
3015.4.1
by Daniel Watkins
Added tests for new command line options. |
66 |
|
67 |
def test_check_tree(self): |
|
68 |
tree = self.make_branch_and_tree('.') |
|
69 |
tree.commit('foo') |
|
70 |
out, err = self.run_bzr('check --tree') |
|
|
3015.4.4
by Daniel Watkins
Strengthened tests. |
71 |
self.assertContainsRe(err, r"^Checking working tree at '.*'\.\n$") |
|
3015.4.8
by Daniel Watkins
Added test to check that two flags both operate. |
72 |
|
73 |
def test_partial_check(self): |
|
74 |
tree = self.make_branch_and_tree('.') |
|
75 |
tree.commit('foo') |
|
76 |
out, err = self.run_bzr('check --tree --branch') |
|
77 |
self.assertContainsRe(err, r"^Checking working tree at '.*'\.\n" |
|
78 |
r"Checking branch at '.*'\.\n" |
|
79 |
r"checked branch.*\n$") |
|
|
3015.4.15
by Daniel Watkins
Added test cases for missing objects. |
80 |
|
81 |
def test_check_missing_tree(self): |
|
82 |
branch = self.make_branch('.') |
|
83 |
out, err = self.run_bzr('check --tree') |
|
84 |
self.assertEqual(err, "No working tree found at specified location.\n") |
|
85 |
||
|
3015.4.17
by Daniel Watkins
Minor test re-org. |
86 |
def test_check_missing_partial(self): |
87 |
branch = self.make_branch('.') |
|
88 |
out, err = self.run_bzr('check --tree --branch') |
|
89 |
self.assertContainsRe(err, |
|
90 |
r"^No working tree found at specified location\.\n" |
|
91 |
r"Checking branch at '.*'\.\n" |
|
92 |
r"checked branch.*\n$") |
|
93 |
||
|
3015.4.18
by Daniel Watkins
Added bzrlib.tests.blackbox.test_check.TestCheck.test_check_missing_branch_in_shared_repo. |
94 |
def test_check_missing_branch_in_shared_repo(self): |
95 |
self.make_repository('shared', shared=True) |
|
96 |
out, err = self.run_bzr('check --branch shared') |
|
97 |
self.assertEqual(err, "No branch found at specified location.\n") |
|
98 |
||
|
3015.4.17
by Daniel Watkins
Minor test re-org. |
99 |
|
100 |
class ChrootedCheckTests(ChrootedTestCase): |
|
101 |
||
|
3015.4.15
by Daniel Watkins
Added test cases for missing objects. |
102 |
def test_check_missing_branch(self): |
103 |
out, err = self.run_bzr( |
|
104 |
'check --branch %s' % self.get_readonly_url('')) |
|
105 |
self.assertEqual(err, "No branch found at specified location.\n") |
|
106 |
||
107 |
def test_check_missing_repository(self): |
|
108 |
out, err = self.run_bzr('check --repo %s' % self.get_readonly_url('')) |
|
109 |
self.assertEqual(err, "No repository found at specified location.\n") |
|
110 |
||
111 |
def test_check_missing_everything(self): |
|
112 |
out, err = self.run_bzr('check %s' % self.get_readonly_url('')) |
|
113 |
self.assertEqual(err, "No working tree found at specified location.\n" |
|
114 |
"No branch found at specified location.\n" |
|
115 |
"No repository found at specified location.\n") |