예제 #1
0
    def test_until_the_restore_unit(self):
        self.fs.path_exists.return_value = False
        trashed_file = TrashedFile('parent/path', None, 'info_file',
                                   'orig_file')

        self.user_reply = '0'
        self.cmd.restore_asking_the_user([trashed_file])

        assert '' == self.stdout.getvalue()
        assert '' == self.stderr.getvalue()
        assert [
            call.path_exists('parent/path'),
            call.mkdirs('parent'),
            call.move('orig_file', 'parent/path'),
            call.remove_file('info_file')
        ] == self.fs.mock_calls
예제 #2
0
    def test_until_the_restore_unit(self):
        trashed_file = TrashedFile('parent/path', None, 'info_file',
                                   'orig_file')
        fs = Mock()
        self.cmd.fs = fs
        self.cmd.path_exists = lambda _: False

        self.user_reply = '0'
        self.cmd.restore_asking_the_user([trashed_file])

        assert_equals('', self.stdout.getvalue())
        assert_equals('', self.stderr.getvalue())
        assert_equals([
            call.mkdirs('parent'),
            call.move('orig_file', 'parent/path'),
            call.remove_file('info_file')
        ], fs.mock_calls)
예제 #3
0
    def test_until_the_restore_unit(self):
        from mock import Mock, call
        trashed_file = TrashedFile(
                'parent/path',
                None,
                'info_file',
                'orig_file')
        fs = Mock()
        self.cmd.fs = fs
        self.cmd.path_exists = lambda _: False

        self.user_reply = '0'
        self.cmd.restore_asking_the_user([trashed_file])

        assert_equals('', self.stdout.getvalue())
        assert_equals('', self.stderr.getvalue())
        assert_equals([
            call.mkdirs('parent')
            , call.move('orig_file', 'parent/path')
            , call.remove_file('info_file')
            ], fs.mock_calls)