Esempio n. 1
0
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))
    ]
Esempio n. 2
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))
    ]
Esempio n. 3
0
 def _allowed_helper(self) -> Check:
     return Check(name="Test", success=True)
Esempio n. 4
0
 def invalid_check(self) -> Check:
     return Check(name="Test", success=True)
Esempio n. 5
0
 def check_four(self) -> Check:
     return Check(name="four", success=True)
Esempio n. 6
0
 def check_two(self) -> Check:
     return Check(name="two", success=True)
Esempio n. 7
0
def test_generate_check_id() -> None:
    check = Check(name="Ensure adequate resources", success=True)
    assert check.id == "c272d5e0"
Esempio n. 8
0
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}'
    )
Esempio n. 9
0
def test_created_at_set_automatically() -> None:
    check = Check(name="Test", success=True)
    assert check.created_at == datetime(2020, 8, 24, 0, 0)
Esempio n. 10
0
 def check_three(self) -> Check:
     return Check(name="3", success=True)
Esempio n. 11
0
 def check_two(self) -> Check:
     return Check(name="2",
                  success=False,
                  severity=ErrorSeverity.critical)
Esempio n. 12
0
 def check_one(self) -> Check:
     return Check(name="1", success=True)
Esempio n. 13
0
 def check_two(self) -> Check:
     return Check(name="2", success=False)
Esempio n. 14
0
 def check_something(self) -> Check:
     return Check(name="Test", success=True)