~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-12 01:10:17 UTC
  • mto: This revision was merged to the branch mainline in revision 2455.
  • Revision ID: amanic@gmail.com-20070412011017-ofzhcgj7o7bnh6dd
* blackbox/test_remove
  - uninvert my logic
  - add a little more testing

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
    def assertFilesDeleted(self,files):
45
45
        for f in files:
46
46
            id=f+_id
47
 
            self.failUnlessExists(f)
48
47
            self.assertNotInWorkingTree(f)
 
48
            self.failIfExists(f)
49
49
 
50
50
    def assertFilesUnversioned(self,files):
51
51
        for f in files:
52
 
            self.failIfExists(f)
53
52
            self.assertNotInWorkingTree(f)
 
53
            self.failUnlessExists(f)
54
54
 
55
55
    def test_remove_no_files_specified(self):
56
56
        tree = self._make_add_and_assert_tree([])
90
90
        self.assertEquals(err.strip(), "a is not versioned.")
91
91
 
92
92
    def test_remove_force_unversioned_files(self):
93
 
        self.build_tree(['a'])
 
93
        self.build_tree([a])
94
94
        tree = self.make_branch_and_tree('.')
95
95
 
96
96
        (out,err) = self.runbzr('remove --force a')
97
97
        self.assertEquals(out.strip(), "")
98
98
        self.assertEquals(err.strip(), "deleted a")
 
99
        self.assertFilesDeleted([a])
99
100
 
100
101
    def test_remove_non_existing_files(self):
101
102
        tree = self._make_add_and_assert_tree([])
111
112
 
112
113
    def test_remove_one_file(self):
113
114
        tree = self._make_add_and_assert_tree([a])
114
 
        self.runbzr('remove a')
115
 
        self.assertFilesDeleted([a])
 
115
        (out,err) = self.runbzr('remove a')
 
116
        self.assertEquals(out.strip(), "")
 
117
        self.assertEquals(err.strip(), "a has changed and won't be deleted.")
 
118
        self.assertFilesUnversioned([a])
 
119
        
 
120
    def test_remove_keep_one_file(self):
 
121
        tree = self._make_add_and_assert_tree([a])
 
122
        (out,err) = self.runbzr('remove --keep a')
 
123
        self.assertEquals(out.strip(), "")
 
124
        self.assertEquals(err.strip(), "removed a")
 
125
        self.assertFilesUnversioned([a])
116
126
 
117
127
    def test_command_on_deleted(self):
118
128
        tree = self._make_add_and_assert_tree([a])
126
136
        tree = self._make_add_and_assert_tree(files)
127
137
 
128
138
        self.runbzr('remove --new')
129
 
        self.assertFilesDeleted(files)
 
139
        self.assertFilesUnversioned(files)
130
140
 
131
141
    def test_command_with_new_in_dir1(self):
132
142
        tree = self._make_add_and_assert_tree(files)
134
144
        tree = WorkingTree.open('.')
135
145
        self.assertInWorkingTree(a)
136
146
        self.assertEqual(tree.path2id(a), a+_id)
137
 
        self.assertFilesDeleted([b,c])
 
147
        self.assertFilesUnversioned([b,c])
138
148
 
139
149
    def test_command_with_new_in_dir2(self):
140
150
        tree = self._make_add_and_assert_tree(files)
141
151
        self.runbzr('remove --new .')
142
152
        tree = WorkingTree.open('.')
143
 
        self.assertFilesDeleted([a])
 
153
        self.assertFilesUnversioned([a])