Example #1
0
 def test_driver_schema(self):
     """
     get the driver schema and verify it is configured properly
     """
     driver = InstrumentDriver(self._got_data_event_callback)
     self.assert_driver_schema(driver, self._driver_parameters,
                               self._driver_capabilities)
Example #2
0
    def test_got_data(self):
        """
        Verify sample data passed through the got data method produces the correct data particles
        """
        # Create and initialize the instrument driver with a mock port agent
        driver = InstrumentDriver(self._got_data_event_callback)
        self.assert_initialize_driver(driver, initial_protocol_state=ProtocolState.FILL)

        self.assert_raw_particle_published(driver, True)

        # validating data particles are published
        self.assert_particle_published(driver, self.RASFL_SAMPLE_DATA1, self.assert_data_particle_sample, True)

        # validate that a duplicate sample is not published - TODO
        #self.assert_particle_not_published(driver, self.RASFL_SAMPLE_DATA1, self.assert_data_particle_sample, True)

        # validate that a new sample is published
        self.assert_particle_published(driver, self.RASFL_SAMPLE_DATA2, self.assert_data_particle_sample, False)
Example #3
0
    def test_capabilities(self):
        """
        Verify the FSM reports capabilities as expected.  All states defined in this dict must
        also be defined in the protocol FSM.
        """
        capabilities = {
            ProtocolState.UNKNOWN: [
                ProtocolEvent.DISCOVER,
            ],
            ProtocolState.COMMAND: [
                ProtocolEvent.GET,
                ProtocolEvent.SET,
                ProtocolEvent.INIT_PARAMS,
                ProtocolEvent.START_DIRECT,
                ProtocolEvent.ACQUIRE_SAMPLE,
                ProtocolEvent.CLEAR,
                ProtocolEvent.CLOCK_SYNC,
            ],
            ProtocolState.FLUSH: [
                ProtocolEvent.FLUSH,
                ProtocolEvent.PUMP_STATUS,
                ProtocolEvent.INSTRUMENT_FAILURE,
            ],
            ProtocolState.FILL: [
                ProtocolEvent.FILL,
                ProtocolEvent.PUMP_STATUS,
                ProtocolEvent.INSTRUMENT_FAILURE,
            ],
            ProtocolState.CLEAR: [
                ProtocolEvent.CLEAR,
                ProtocolEvent.PUMP_STATUS,
                ProtocolEvent.INSTRUMENT_FAILURE,
            ],
            ProtocolState.RECOVERY: [
            ],
            ProtocolState.DIRECT_ACCESS: [
                ProtocolEvent.STOP_DIRECT,
                ProtocolEvent.EXECUTE_DIRECT,
            ],
        }

        driver = InstrumentDriver(self._got_data_event_callback)
        self.assert_capabilities(driver, capabilities)