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: ['DRIVER_EVENT_DISCOVER'],
            ProtocolState.COMMAND: [
                'DRIVER_EVENT_GET', 'DRIVER_EVENT_SET',
                'DRIVER_EVENT_START_AUTOSAMPLE', 'DRIVER_EVENT_START_DIRECT',
                'DRIVER_EVENT_ACQUIRE_SAMPLE', 'DRIVER_EVENT_ACQUIRE_STATUS',
                'DRIVER_EVENT_CLOCK_SYNC', 'DRIVER_EVENT_FLASH_STATUS'
            ],
            ProtocolState.AUTOSAMPLE: [
                'DRIVER_EVENT_STOP_AUTOSAMPLE', 'DRIVER_EVENT_GET',
                'DRIVER_EVENT_ACQUIRE_SAMPLE', 'DRIVER_EVENT_ACQUIRE_STATUS',
                'DRIVER_EVENT_CLOCK_SYNC', 'DRIVER_EVENT_FLASH_STATUS'
            ],
            ProtocolState.DIRECT_ACCESS:
            ['DRIVER_EVENT_STOP_DIRECT', 'EXECUTE_DIRECT'],
            ProtocolState.SYNC_CLOCK: ['DRIVER_EVENT_CLOCK_SYNC']
        }

        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_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.METBK_STATUS_DATA,
                                       self.assert_data_particle_status, True)
        self.assert_particle_published(driver, self.METBK_SAMPLE_DATA1,
                                       self.assert_data_particle_sample, True)

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

        # validate that a new sample is published
        self.assert_particle_published(driver, self.METBK_SAMPLE_DATA2,
                                       self.assert_data_particle_sample, False)