def test_already_finished(self): registry.register(SimpleHandler, ['something']) request = toolbox.add_request('abc', file_type='something') request.finished_at = timezone.now() request.save() self.assertFalse(registry.dispatch(request.id)) self.assertEqual(0, len(SimpleHandler.handled))
def test_no_handler(self): request = toolbox.add_request('abc') self.assertRaises(KeyError, registry.dispatch, request.id) registry.register(SimpleHandler, ['something']) self.assertRaises(KeyError, registry.dispatch, request.id)
def test(self): registry.register(SimpleHandler, ['something']) request = toolbox.add_request('abc', file_type='something') self.assertTrue(registry.dispatch(request.id)) self.assertEqual([request], SimpleHandler.handled)