def test_extra_settings(self, subject): subject.EXTRA_SETTINGS = [ SettingDefinition(name="_foo", kind="password", value="default"), SettingDefinition(name="_bar", kind="integer", value=0), ] settings = subject.extra_settings # Known, overwritten in plugin/variant definition foo_setting = find_named(settings, "_foo") assert foo_setting assert foo_setting.kind == "password" assert foo_setting.value == "bar" assert not foo_setting.is_custom # Known, not overwritten bar_setting = find_named(settings, "_bar") assert bar_setting assert bar_setting.kind == "integer" assert bar_setting.value == 0 assert not bar_setting.is_custom # Unknown, set in plugin/variant definition baz_setting = find_named(settings, "_baz") assert baz_setting assert baz_setting.kind is None assert baz_setting.value == "qux" assert not baz_setting.is_custom
def get_variant(self, variant_name: str) -> Variant: try: return find_named(self.variants, variant_name) except NotFound as err: raise VariantNotFoundError(self, variant_name) from err
def table_conf_by_name(self, table_name, cls, prop, file_name): try: return find_named(self.tables, table_name) except NotFound as e: raise MeltanoAnalysisFileParserMissingTableError( prop, table_name, cls, file_name)
def get_profile(self, profile_name: str) -> Profile: if profile_name == Profile.DEFAULT.name: return Profile.DEFAULT return find_named(self.profiles, profile_name)
def find_setting(self, plugin: PluginRef, name: str) -> Dict: try: return find_named(self.definitions(plugin), name) except NotFound as err: raise PluginSettingMissingError(plugin, name) from err
def find_setting(self, name: str) -> SettingDefinition: try: return find_named(self.definitions(), name) except NotFound as err: raise SettingMissingError(name) from err