Пример #1
0
    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()
Пример #2
0
    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()
Пример #3
0
 def test_run(self):
     backend = MagicMock()
     listener = Listener(backend)
     listener.run()
     backend.get_implementation.return_value.listen.assert_called_once()
Пример #4
0
 def test_run(self):
     backend = MagicMock()
     listener = Listener(backend)
     listener.run()
     backend.get_implementation.return_value.listen.assert_called_once()