Beispiel #1
0
    def test_discover_state(self):
        """
        Test discovering the instrument in the COMMAND state and in the AUTOSAMPLE state
        """
        mock_callback = Mock()
        protocol = FlordProtocol(Prompt, NEWLINE, mock_callback)

        # COMMAND state, wait for particles returns an empty list
        protocol.wait_for_particles = Mock(return_value=[])
        next_state, result = protocol._handler_unknown_discover()
        self.assertEqual(next_state, DriverProtocolState.COMMAND)

        # AUTOSAMPLE state, wait for particles returns one or more particles
        protocol.wait_for_particles = Mock(return_value=[1])
        next_state, result = protocol._handler_unknown_discover()
        self.assertEqual(next_state, DriverProtocolState.AUTOSAMPLE)
Beispiel #2
0
    def test_discover_state(self):
        """
        Test discovering the instrument in the COMMAND state and in the AUTOSAMPLE state
        """
        mock_callback = Mock()
        protocol = FlordProtocol(Prompt, NEWLINE, mock_callback)

        # COMMAND state
        protocol._particle_dict = {}
        next_state, result = protocol._handler_unknown_discover()
        self.assertEqual(next_state, DriverProtocolState.COMMAND)

        # AUTOSAMPLE state
        protocol._particle_dict = {DataParticleType.FLORDD_SAMPLE: None}
        next_state, result = protocol._handler_unknown_discover()
        self.assertEqual(next_state, DriverProtocolState.AUTOSAMPLE)
    def test_discover_state(self):
        """
        Test discovering the instrument in the COMMAND state and in the AUTOSAMPLE state
        """
        mock_callback = Mock()
        protocol = FlordProtocol(Prompt, NEWLINE, mock_callback)

        # COMMAND state, wait for particles returns an empty list
        protocol.wait_for_particles = Mock(return_value=[])
        next_state, result = protocol._handler_unknown_discover()
        self.assertEqual(next_state, DriverProtocolState.COMMAND)

        # AUTOSAMPLE state, wait for particles returns one or more particles
        protocol.wait_for_particles = Mock(return_value=[1])
        next_state, result = protocol._handler_unknown_discover()
        self.assertEqual(next_state, DriverProtocolState.AUTOSAMPLE)
Beispiel #4
0
    def test_discover_state(self):
        """
        Test discovering the instrument in the COMMAND state and in the AUTOSAMPLE state
        """
        mock_callback = Mock()
        protocol = FlordProtocol(Prompt, NEWLINE, mock_callback)

        #COMMAND state
        protocol._linebuf = SAMPLE_MNU_RESPONSE
        protocol._promptbuf = SAMPLE_MNU_RESPONSE
        next_state, next_agent_state = protocol._handler_unknown_discover()
        self.assertEqual(next_state, DriverProtocolState.COMMAND)
        self.assertEqual(next_agent_state, ResourceAgentState.IDLE)

        #AUTOSAMPLE state
        protocol._linebuf = SAMPLE_SAMPLE_RESPONSE
        protocol._promptbuf = SAMPLE_SAMPLE_RESPONSE
        next_state, next_agent_state = protocol._handler_unknown_discover()
        self.assertEqual(next_state, DriverProtocolState.AUTOSAMPLE)
        self.assertEqual(next_agent_state, ResourceAgentState.STREAMING)
    def test_discover_state(self):
        """
        Test discovering the instrument in the COMMAND state and in the AUTOSAMPLE state
        """
        mock_callback = Mock()
        protocol = FlordProtocol(Prompt, NEWLINE, mock_callback)

        #COMMAND state
        protocol._linebuf = SAMPLE_MNU_RESPONSE
        protocol._promptbuf = SAMPLE_MNU_RESPONSE
        next_state, next_agent_state = protocol._handler_unknown_discover()
        self.assertEqual(next_state, DriverProtocolState.COMMAND)
        self.assertEqual(next_agent_state, ResourceAgentState.IDLE)

        #AUTOSAMPLE state
        protocol._linebuf = SAMPLE_SAMPLE_RESPONSE
        protocol._promptbuf = SAMPLE_SAMPLE_RESPONSE
        next_state, next_agent_state = protocol._handler_unknown_discover()
        self.assertEqual(next_state, DriverProtocolState.AUTOSAMPLE)
        self.assertEqual(next_agent_state, ResourceAgentState.STREAMING)