~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/test_smart_add.py

  • Committer: Robert Collins
  • Date: 2005-08-25 02:43:15 UTC
  • mto: (974.1.50) (1185.1.10) (1092.3.1)
  • mto: This revision was merged to the branch mainline in revision 1139.
  • Revision ID: robertc@robertcollins.net-20050825024315-01e64162aa925ac3
change smart_add reporting of added files to callback with the entry, and change the inventory.add signature to return the added entry

Show diffs side-by-side

added added

removed removed

Lines of Context:
137
137
        smart_add_branch(branch, paths, False, True)
138
138
        for path in paths:
139
139
            self.assertNotEqual(branch.inventory.path2id(path), None)
 
140
 
 
141
class TestAddCallbacks(TestCase):
 
142
 
 
143
    def setUp(self):
 
144
        from bzrlib.inventory import InventoryEntry
 
145
        super(TestAddCallbacks, self).setUp()
 
146
        self.entry = InventoryEntry("id", "name", "file", None)
 
147
 
 
148
    def test_null_callback(self):
 
149
        from bzrlib.add import _NullAddCallback
 
150
        _NullAddCallback(self.entry)
 
151
 
 
152
    def test_print_callback(self):
 
153
        from bzrlib.add import _PrintAddCallback
 
154
        from StringIO import StringIO
 
155
        stdout = StringIO()
 
156
        self.apply_redirected(None, stdout, None, _PrintAddCallback,
 
157
                              self.entry)
 
158
        self.assertEqual(stdout.getvalue(), "added name\n")