bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
1 |
# Copyright (C) 2008, 2009, 2010, 2016 Canonical Ltd
|
|
3251.6.6
by John Arbash Meinel
Fix the line endings of bzrlib.tests.blackbox.test_modified, they were dos, should be unix |
2 |
# -*- coding: utf-8 -*-
|
3 |
#
|
|
4 |
# This program is free software; you can redistribute it and/or modify
|
|
5 |
# it under the terms of the GNU General Public License as published by
|
|
6 |
# the Free Software Foundation; either version 2 of the License, or
|
|
7 |
# (at your option) any later version.
|
|
8 |
#
|
|
9 |
# This program is distributed in the hope that it will be useful,
|
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
# GNU General Public License for more details.
|
|
13 |
#
|
|
14 |
# You should have received a copy of the GNU General Public License
|
|
15 |
# along with this program; if not, write to the Free Software
|
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
3251.6.6
by John Arbash Meinel
Fix the line endings of bzrlib.tests.blackbox.test_modified, they were dos, should be unix |
17 |
|
18 |
||
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
19 |
"""Black-box tests for 'brz modified', which shows modified files."""
|
|
3251.6.6
by John Arbash Meinel
Fix the line endings of bzrlib.tests.blackbox.test_modified, they were dos, should be unix |
20 |
|
21 |
import os |
|
22 |
||
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
23 |
from breezy.branch import Branch |
24 |
from breezy.tests import TestCaseWithTransport |
|
|
3251.6.6
by John Arbash Meinel
Fix the line endings of bzrlib.tests.blackbox.test_modified, they were dos, should be unix |
25 |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
26 |
|
|
5283.4.5
by Martin Pool
Update remaining subclasses of ExternalBase |
27 |
class TestModified(TestCaseWithTransport): |
|
3251.6.6
by John Arbash Meinel
Fix the line endings of bzrlib.tests.blackbox.test_modified, they were dos, should be unix |
28 |
|
29 |
def test_modified(self): |
|
30 |
"""Test that 'modified' command reports modified files""" |
|
31 |
self._test_modified('a', 'a') |
|
32 |
||
33 |
def test_modified_with_spaces(self): |
|
34 |
"""Test that 'modified' command reports modified files with spaces in their names quoted""" |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
35 |
self._test_modified('a filename with spaces', |
36 |
'"a filename with spaces"') |
|
|
3251.6.6
by John Arbash Meinel
Fix the line endings of bzrlib.tests.blackbox.test_modified, they were dos, should be unix |
37 |
|
38 |
def _test_modified(self, name, output): |
|
39 |
||
40 |
def check_modified(expected, null=False): |
|
41 |
command = 'modified' |
|
42 |
if null: |
|
43 |
command += ' --null' |
|
44 |
out, err = self.run_bzr(command) |
|
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
45 |
self.assertEqual(out, expected) |
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
46 |
self.assertEqual(err, '') |
|
3251.6.6
by John Arbash Meinel
Fix the line endings of bzrlib.tests.blackbox.test_modified, they were dos, should be unix |
47 |
|
48 |
# in empty directory, nothing modified
|
|
49 |
tree = self.make_branch_and_tree('.') |
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
50 |
check_modified('') |
|
3251.6.6
by John Arbash Meinel
Fix the line endings of bzrlib.tests.blackbox.test_modified, they were dos, should be unix |
51 |
|
52 |
# with unknown file, still nothing modified
|
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
53 |
self.build_tree_contents( |
54 |
[(name, b'contents of %s\n' % (name.encode('utf-8')))]) |
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
55 |
check_modified('') |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
56 |
|
|
3251.6.6
by John Arbash Meinel
Fix the line endings of bzrlib.tests.blackbox.test_modified, they were dos, should be unix |
57 |
# after add, not modified
|
58 |
tree.add(name) |
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
59 |
check_modified('') |
|
3251.6.6
by John Arbash Meinel
Fix the line endings of bzrlib.tests.blackbox.test_modified, they were dos, should be unix |
60 |
|
61 |
# after commit, not modified
|
|
62 |
tree.commit(message='add %s' % output) |
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
63 |
check_modified('') |
|
3251.6.6
by John Arbash Meinel
Fix the line endings of bzrlib.tests.blackbox.test_modified, they were dos, should be unix |
64 |
|
65 |
# modify the file
|
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
66 |
self.build_tree_contents([(name, b'changed\n')]) |
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
67 |
check_modified(output + '\n') |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
68 |
|
|
3251.6.6
by John Arbash Meinel
Fix the line endings of bzrlib.tests.blackbox.test_modified, they were dos, should be unix |
69 |
# check null seps - use the unquoted raw name here
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
70 |
check_modified(name + '\0', null=True) |
|
3251.6.6
by John Arbash Meinel
Fix the line endings of bzrlib.tests.blackbox.test_modified, they were dos, should be unix |
71 |
|
72 |
# now commit the file and it's no longer modified
|
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
73 |
tree.commit(message='modified %s' % (name)) |
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
74 |
check_modified('') |
|
3251.6.6
by John Arbash Meinel
Fix the line endings of bzrlib.tests.blackbox.test_modified, they were dos, should be unix |
75 |
|
|
5171.3.7
by Martin von Gagern
Added blackbox tests for --directory option. |
76 |
def test_modified_directory(self): |
77 |
"""Test --directory option""" |
|
78 |
tree = self.make_branch_and_tree('a') |
|
79 |
self.build_tree(['a/README']) |
|
80 |
tree.add('README') |
|
81 |
tree.commit('r1') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
82 |
self.build_tree_contents([('a/README', b'changed\n')]) |
|
5171.3.7
by Martin von Gagern
Added blackbox tests for --directory option. |
83 |
out, err = self.run_bzr(['modified', '--directory=a']) |
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
84 |
self.assertEqual('README\n', out) |