def test_app_iter_ranges_with_no_ranges(self): dfr = DiskFileReader(make_client_collection(), 'obj', False, logger=logging.root) gen = dfr.app_iter_ranges([], mock.sentinel.arg1, mock.sentinel.arg2, mock.sentinel.arg3) self.assertEqual('', gen.next()) self.assertRaises(StopIteration, gen.next)
def test_app_iter_ranges(self, mock_mri): mock_mri.return_value = iter(['data']) dfr = DiskFileReader(make_client_collection(), 'obj', False, logger=logging.root) gen = dfr.app_iter_ranges([(1, 100)], mock.sentinel.arg1, mock.sentinel.arg2, mock.sentinel.arg3) self.assertEqual('data', gen.next()) self.assertRaises(StopIteration, gen.next) mock_mri.assert_called_once_with([(1, 100)], mock.sentinel.arg1, mock.sentinel.arg2, mock.sentinel.arg3, dfr.app_iter_range)