async def test_valid_checks() -> None: class MeasureChecks(BaseChecks): def check_something(self) -> Check: return Check(name="Test", success=True) config = BaseConfiguration() checks = await MeasureChecks.run(config) assert checks == [ Check(name="Test", success=True, created_at=datetime(2020, 8, 24, 0, 0)) ]
async def test_run_as_instance() -> None: class MeasureChecks(BaseChecks): def check_something(self) -> Check: return Check(name="Test", success=True) config = BaseConfiguration() checker = MeasureChecks(config) checks = await checker.run_all() assert checks == [ Check(name="Test", success=True, created_at=datetime(2020, 8, 24, 0, 0)) ]
def _allowed_helper(self) -> Check: return Check(name="Test", success=True)
def invalid_check(self) -> Check: return Check(name="Test", success=True)
def check_four(self) -> Check: return Check(name="four", success=True)
def check_two(self) -> Check: return Check(name="two", success=True)
def test_generate_check_id() -> None: check = Check(name="Ensure adequate resources", success=True) assert check.id == "c272d5e0"
def test_serialize_with_exception() -> None: exception = RuntimeError("Testing") check = Check(name="Test", success=False, exception=exception) assert check.json() == ( '{"name": "Test", "id": "1bab7e8d", "description": null, "severity": "common", "tags": null, "success": false, "message": null, "hint": null, "remedy": null, "exception": "RuntimeError(\'Testing\')", "created_at": "2020-08-24T00:00:00", "run_at": null, "runtime": null}' )
def test_created_at_set_automatically() -> None: check = Check(name="Test", success=True) assert check.created_at == datetime(2020, 8, 24, 0, 0)
def check_three(self) -> Check: return Check(name="3", success=True)
def check_two(self) -> Check: return Check(name="2", success=False, severity=ErrorSeverity.critical)
def check_one(self) -> Check: return Check(name="1", success=True)
def check_two(self) -> Check: return Check(name="2", success=False)
def check_something(self) -> Check: return Check(name="Test", success=True)