Example #1
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.ACQUIRE_SAMPLE,
                ProtocolEvent.START_AUTOSAMPLE,
                ProtocolEvent.START_DIRECT,
            ],
            ProtocolState.AUTOSAMPLE: [
                ProtocolEvent.STOP_AUTOSAMPLE,
                ProtocolEvent.ACQUIRE_SAMPLE,
            ],
            ProtocolState.DIRECT_ACCESS: [
                ProtocolEvent.STOP_DIRECT,
                ProtocolEvent.EXECUTE_DIRECT,
            ]
        }

        driver = InstrumentDriver(self._got_data_event_callback)
        self.assert_capabilities(driver, capabilities)
Example #2
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 #3
0
    def test_got_rsn_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)

        self.assert_raw_particle_published(driver, True)

        # validating data particles are published
        self.assert_particle_published(driver, self.RSN_SAMPLE_DATA,
                                       self.assert_rsn_data_particle_sample,
                                       True)