class MatchItemGeneratorLocDep(ABCMatchItemGenerator): match_item = MatchItem( title="localization_dependent", topic="Localization-dependent", url="", match_texts=["localization_dependent"], ) @property def name(self) -> str: return "localization_dependent" def generate_match_items(self) -> MatchItems: yield self.match_item @staticmethod def is_affected_by_change(_change_action_name: str) -> bool: return False @property def is_localization_dependent(self) -> bool: return True
def test_match_item_generator_hosts(): assert list( hosts_and_folders.MatchItemGeneratorHosts( "hosts", lambda: { "host": { "edit_url": "some_url", "alias": "alias", "ipaddress": "1.2.3.4", "ipv6address": "", "additional_ipv4addresses": ["5.6.7.8"], "additional_ipv6addresses": [], }, }, ).generate_match_items()) == [ MatchItem( title="host", topic="Hosts", url="some_url", match_texts=["host", "alias", "1.2.3.4", "5.6.7.8"], ) ]