~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to tests.py

  • Committer: Michael Ellerman
  • Date: 2006-02-21 04:52:27 UTC
  • mto: (0.1.73 shelf-tmp)
  • mto: This revision was merged to the branch mainline in revision 334.
  • Revision ID: michael@ellerman.id.au-20060221045227-387f2698220d484c
Add basic test for shelf show

Show diffs side-by-side

added added

removed removed

Lines of Context:
139
139
        file('foo', 'wb').write('baz')
140
140
        self.run_bzr('shelve', 'foo', retcode=0)
141
141
 
 
142
    def test_shelf_show_basic(self):
 
143
        tree = self.make_branch_and_tree('.')
 
144
        self.__create_and_add_test_file(tree)
 
145
 
 
146
        # Modify the test file
 
147
        self.build_tree_contents([('test_file', self.MODIFIED)])
 
148
 
 
149
        # Shelve the changes
 
150
        self.run_bzr('shelve', retcode=0)
 
151
 
 
152
        # Make sure there is no diff anymore
 
153
        self.assertEqual(self.capture('diff', retcode=0), '')
 
154
 
 
155
        # Check the shelf is right
 
156
        shelf = open(os.path.join(tree.branch.base,
 
157
                    '.shelf/shelves/default/00')).read()
 
158
        shelf = shelf[shelf.index('\n') + 1:] # skip the message
 
159
        self.assertEqual(shelf, self.DIFF_1)
 
160
 
 
161
        # Check the shown output is right
 
162
        shown = self.capture('shelf show 00', retcode=0)
 
163
        shown = shown[shown.index('\n') + 1:] # skip the message
 
164
        self.assertEqual(shown, shelf)