Ejemplo n.º 1
0
def test_get_groups_from_json_empty_list():
    groups = get_groups_from_json([])
    assert groups == {}
    # empty or whitespace strings should also be ignored
    groups = get_groups_from_json([''])
    assert groups == {}
    groups = get_groups_from_json(['  ', '', ' '])
    assert groups == {}
Ejemplo n.º 2
0
    def init_device(self):
        Device.init_device(self)
        # PROTECTED REGION ID(SKABaseDevice.init_device) ENABLED START #

        # Initialize attribute values.
        self._build_state = '{}, {}, {}'.format(release.name, release.version,
                                                release.description)
        self._version_id = release.version
        self._central_logging_level = 0
        self._element_logging_level = 0
        self._storage_logging_level = 0
        self._health_state = 0
        self._admin_mode = 0
        self._control_mode = 0
        self._simulation_mode = False
        self._test_mode = ""
        #logger.setLevel(logging.DEBUG)

        # create TANGO Groups objects dict, according to property
        self.debug_stream("Groups definitions: {}".format(self.GroupDefinitions))
        try:
            self.groups = get_groups_from_json(self.GroupDefinitions)
            self.info_stream("Groups loaded: {}".format(sorted(self.groups.keys())))
        except GroupDefinitionsError:
            self.info_stream("No Groups loaded for device: {}".format(
                                 self.get_name()))
Ejemplo n.º 3
0
def test_get_groups_from_json_valid(valid_group_configs):
    json_definitions = _jsonify_group_configs(valid_group_configs)
    groups = get_groups_from_json(json_definitions)

    # Check result
    assert len(groups) == len(valid_group_configs)
    for group_config in valid_group_configs:
        name = group_config['group_name']
        group = groups[name]
        _validate_group(group_config, group)
Ejemplo n.º 4
0
def test_get_groups_from_json_invalid(bad_group_configs):
    json_definitions = _jsonify_group_configs(bad_group_configs)
    with pytest.raises(GroupDefinitionsError):
        get_groups_from_json(json_definitions)