'Testing whether the right operations happen after a torrent checked alert is received'

def test_torrent_checked_alert(self):

    def mocked_pause_checkpoint():
        mocked_pause_checkpoint.called = True
    mocked_pause_checkpoint.called = False
    self.libtorrent_download_impl.handle.pause = mocked_pause_checkpoint
    self.libtorrent_download_impl.checkpoint = mocked_pause_checkpoint
    mock_alert = MockObject()
    mock_alert.category = (lambda : lt.alert.category_t.error_notification)
    self.libtorrent_download_impl.pause_after_next_hashcheck = True
    self.libtorrent_download_impl.process_alert(mock_alert, 'torrent_checked_alert')
    self.assertFalse(self.libtorrent_download_impl.pause_after_next_hashcheck)
    self.assertTrue(mocked_pause_checkpoint.called)
    mocked_pause_checkpoint.called = False
    self.libtorrent_download_impl.checkpoint_after_next_hashcheck = True
    self.libtorrent_download_impl.process_alert(mock_alert, 'torrent_checked_alert')
    self.assertFalse(self.libtorrent_download_impl.checkpoint_after_next_hashcheck)
    self.assertTrue(mocked_pause_checkpoint.called)
