def test_handle_listener(self, Listener, ListenerManager, Backend): backend = object() Backend.objects.get.return_value = backend command = Command() command.handle(BACKEND='foo') ListenerManager.assert_not_called() Listener.assert_called_with(backend) Listener.return_value.run.assert_called()
def test_handle(self, ListenerManager): command = Command() command.handle() ListenerManager.assert_called_once() ListenerManager.return_value.run.assert_called_once()