예제 #1
0
    def test_driver_enums(self):
        """
        Verify that all driver enumeration has no duplicate values that might cause confusion.  Also
        do a little extra validation for the Capabilites
        """
        self.assert_enum_has_no_duplicates(Command())
        self.assert_enum_has_no_duplicates(ScheduledJob())
        self.assert_enum_has_no_duplicates(DataParticleType())
        self.assert_enum_has_no_duplicates(PARProtocolState())
        self.assert_enum_has_no_duplicates(PARProtocolEvent())
        self.assert_enum_has_no_duplicates(Parameter())

        # Test capabilites for duplicates, them verify that capabilities is a subset of proto events
        self.assert_enum_has_no_duplicates(PARCapability())
        self.assert_enum_complete(PARCapability(), PARProtocolEvent())
예제 #2
0
    def test_metadata_generation(self):
        """
        Verify the driver generates metadata information
        """
        self.assert_initialize_driver()

        self.assert_metadata_generation(instrument_params=Parameter.list(), commands=PARCapability.list())

        # check one to see that the file is loading data from somewhere.
        json_result = self.driver_client.cmd_dvr("get_config_metadata")
        result = json.loads(json_result)

        params = result[ConfigMetadataKey.PARAMETERS]
        self.assertEqual(params[Parameter.MAXRATE][ParameterDictKey.DISPLAY_NAME], "Max Rate")

        cmds = result[ConfigMetadataKey.COMMANDS]
        self.assertEqual(cmds[PARCapability.ACQUIRE_SAMPLE][CommandDictKey.DISPLAY_NAME], "Acquire Sample")
예제 #3
0
 def test_get_param(self):
     # try single
     result = self.par_proto.get([Parameter.MAXRATE])
     self.mock_logger_client.send.assert_called_with("show %s\n" %
                                                     Parameter.MAXRATE)
     
     # try group
     result = self.par_proto.get(Parameter.list())
     
     # try empty set
     self.mock_logger_client.reset_mock()
     result = self.par_proto.get([])
     self.assertEquals(result, {})
     self.assertEquals(self.mock_logger_client.send.call_count, 0)
     
     # try bad param
     self.assertRaises(InstrumentProtocolException, self.par_proto.get, None)
     self.assertRaises(InstrumentProtocolException,
                       self.par_proto.get,['bad_param'])
예제 #4
0
    def test_metadata_generation(self):
        """
        Verify the driver generates metadata information
        """
        self.assert_initialize_driver()

        self.assert_metadata_generation(instrument_params=Parameter.list(),
                                        commands=PARCapability.list())

        # check one to see that the file is loading data from somewhere.
        json_result = self.driver_client.cmd_dvr("get_config_metadata")
        result = json.loads(json_result)

        params = result[ConfigMetadataKey.PARAMETERS]
        self.assertEqual(
            params[Parameter.MAXRATE][ParameterDictKey.DISPLAY_NAME],
            "Max Rate")

        cmds = result[ConfigMetadataKey.COMMANDS]
        self.assertEqual(
            cmds[PARCapability.ACQUIRE_SAMPLE][CommandDictKey.DISPLAY_NAME],
            "Acquire Sample")