~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart_add.py

  • Committer: John Arbash Meinel
  • Date: 2006-01-06 00:23:18 UTC
  • mto: (1685.1.1 bzr-encoding)
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: john@arbash-meinel.com-20060106002318-4176733fedf61161
Refactoring AddAction to allow redirecting to an encoding file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
182
182
class TestAddActions(TestCaseInTempDir):
183
183
 
184
184
    def test_null(self):
185
 
        from bzrlib.add import add_action_null
186
 
        self.run_action(add_action_null, "", False)
 
185
        self.run_action("", False)
187
186
 
188
187
    def test_add(self):
189
 
        self.entry = InventoryFile("id", "name", None)
190
 
        from bzrlib.add import add_action_add
191
 
        self.run_action(add_action_add, "", True)
 
188
        self.run_action("", True)
192
189
 
193
190
    def test_add_and_print(self):
194
 
        from bzrlib.add import add_action_add_and_print
195
 
        self.run_action(add_action_add_and_print, "added path\n", True)
 
191
        self.run_action("added path\n", True)
196
192
 
197
193
    def test_print(self):
198
 
        from bzrlib.add import add_action_print
199
 
        self.run_action(add_action_print, "added path\n", False)
 
194
        self.run_action("added path\n", False)
200
195
 
201
 
    def run_action(self, action, output, should_add):
202
 
        from StringIO import StringIO
 
196
    def run_action(self, output, should_add):
 
197
        from bzrlib.add import AddAction
 
198
        from cStringIO import StringIO
203
199
        inv = Inventory()
204
200
        stdout = StringIO()
 
201
        action = AddAction(to_file=stdout,
 
202
            should_print=bool(output), should_add=should_add)
205
203
 
206
204
        self.apply_redirected(None, stdout, None, action, inv, 'path', 'file')
207
205
        self.assertEqual(stdout.getvalue(), output)