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_run(self): backend = MagicMock() listener = Listener(backend) listener.run() backend.get_implementation.return_value.listen.assert_called_once()