Пример #1
0
 def test_create(self, mock_uploaded_control_constructor,
                 mock_upload_file, mock_uploaded_protocol):
     manager = ProtocolManager()
     p = manager.create(mock_upload_file, [])
     mock_uploaded_control_constructor.assert_called_once_with(
         Path(mock_upload_file.filename).stem, mock_upload_file, [])
     assert p == mock_uploaded_protocol
     assert manager._protocols[mock_uploaded_protocol.meta.identifier] == p
Пример #2
0
    def test_create_raises(self,
                           exception,
                           mock_upload_file,
                           mock_uploaded_protocol):
        with patch("robot_server.service.protocol.manager.UploadedProtocol") \
                as mock_construct:
            def raiser(*args, **kwargs):
                raise exception()

            mock_construct.side_effect = raiser

            with pytest.raises(errors.ProtocolIOException):
                manager = ProtocolManager()
                manager.create(mock_upload_file, [])
Пример #3
0
def manager_with_mock_protocol(mock_uploaded_control_constructor,
                               mock_upload_file):
    manager = ProtocolManager()
    manager.create(mock_upload_file, [])
    return manager
Пример #4
0
 def test_get_none(self):
     manager = ProtocolManager()
     assert list(manager.get_all()) == []
Пример #5
0
def get_protocol_manager() -> ProtocolManager:
    """The single protocol manager instance"""
    return ProtocolManager()
Пример #6
0
def session_manager(hardware) -> SessionManager:
    return SessionManager(hardware, ProtocolManager())
Пример #7
0
def session_manager(hardware) -> SessionManager:
    return SessionManager(hardware=hardware,
                          motion_lock=ThreadedAsyncLock(),
                          protocol_manager=ProtocolManager())