示例#1
0
 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))
示例#2
0
 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))
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
 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)
示例#6
0
 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)