def check_instance(self, idx: int, provider_ref: str, **kwargs): message = super().check_instance(idx, provider_ref, **kwargs) if message: return message if self.multi_messages: return checks.Info("foo"), checks.Warn("bar")
def double_check(**_): return ( checks.Warn("Warn message", "Remove warning messages", obj="App"), checks.Info( "Info message", ["Just a tip really message.", "This is also a multi-paragraph hint as an example of what can be done."], obj="App" ), )
def test_checks__multiple_instance_messages(self): target = ProviderFactoryTest(multi_messages=True) with settings.modify() as ctx: ctx.TEST_PROVIDERS = ("tests.conf.helpers.test_providers.ProviderBaseTest",) actual = target.checks(settings=settings) assert actual == [checks.Info("foo"), checks.Warn("bar")]
def sample_check(settings: Settings, **_): # Return results of a check, normally a successful check returns nothing # but this is an example. return checks.Info("This is a sample message")