~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_remove.py

  • Committer: Marius Kruger
  • Date: 2007-04-14 11:57:26 UTC
  • mto: This revision was merged to the branch mainline in revision 2455.
  • Revision ID: amanic@gmail.com-20070414115726-kykcsm9pztykst1w
Revert test_too_much.py and just do the minimum te get the tests to pass.
Add some test to test_remove.py.
Let test_remove.py make safe id's.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
 
18
 
import os
 
18
import os, re
19
19
 
20
20
from bzrlib.tests.blackbox import ExternalBase
21
21
from bzrlib.workingtree import WorkingTree
34
34
        tree = self.make_branch_and_tree('.')
35
35
        self.build_tree(files)
36
36
        for f in files:
37
 
            id=f+_id
 
37
            id=str(f).replace('/', '_') + _id
38
38
            tree.add(f, id)
39
39
            self.assertEqual(tree.path2id(f), id)
40
40
            self.failUnlessExists(f)
110
110
        self.assertEquals(out.strip(), "")
111
111
        self.assertEquals(err.strip(), "b is not versioned.")
112
112
 
 
113
    def test_rm_one_file(self):
 
114
        tree = self._make_add_and_assert_tree([a])
 
115
        self.run_bzr_captured(['commit', '-m', 'added a'])
 
116
        (out, err) = self.run_bzr_captured(['rm', 'a'])
 
117
        self.assertEquals(out.strip(), "")
 
118
        self.assertEquals(err.strip(), "deleted a")
 
119
        self.assertFilesDeleted([a])
 
120
 
113
121
    def test_remove_one_file(self):
114
122
        tree = self._make_add_and_assert_tree([a])
 
123
        self.run_bzr_captured(['commit', '-m', 'added a'])
115
124
        (out, err) = self.run_bzr_captured(['remove', 'a'])
116
125
        self.assertEquals(out.strip(), "")
117
 
        self.assertEquals(err.strip(), "a has changed and won't be deleted.")
118
 
        self.assertFilesUnversioned([a])
119
 
        
 
126
        self.assertEquals(err.strip(), "deleted a")
 
127
        self.assertFilesDeleted([a])
 
128
 
120
129
    def test_remove_keep_one_file(self):
121
130
        tree = self._make_add_and_assert_tree([a])
122
131
        (out, err) = self.run_bzr_captured(['remove', '--keep', 'a'])
124
133
        self.assertEquals(err.strip(), "removed a")
125
134
        self.assertFilesUnversioned([a])
126
135
 
 
136
    def test_remove_files(self):
 
137
        tree = self._make_add_and_assert_tree(files)
 
138
        self.run_bzr_captured(['commit', '-m', 'added files'])
 
139
        (out, err) = self.run_bzr_captured(['remove', a, b, c])
 
140
        self.assertEquals(out.strip(), "")
 
141
        self.assertTrue(re.search("deleted a", err))
 
142
        self.assertTrue(re.search("deleted b", err))
 
143
        self.assertTrue(re.search("deleted b/c", err))
 
144
        self.assertFilesDeleted(files)
 
145
 
 
146
    def test_remove_keep_files(self):
 
147
        tree = self._make_add_and_assert_tree(files)
 
148
        (out, err) = self.run_bzr_captured(['remove', '--keep', a, b, c])
 
149
        self.assertEquals(out.strip(), "")
 
150
        self.assertTrue(re.search("removed a", err))
 
151
        self.assertTrue(re.search("removed b", err))
 
152
        self.assertTrue(re.search("removed b/c", err))
 
153
        self.assertFilesUnversioned(files)
 
154
 
127
155
    def test_command_on_deleted(self):
128
156
        tree = self._make_add_and_assert_tree([a])
129
157
        self.run_bzr_captured(['commit', '-m', 'added a'])