コード例 #1
0
def test_software_system_instance_name_is_software_system_name(model_with_system):
    """Ensure software_system instance takes its name from its software system."""
    io = SoftwareSystemInstanceIO(
        software_system_id="19", instance_id=3, environment="Live"
    )

    instance = SoftwareSystemInstance.hydrate(io, model_with_system, parent=None)

    assert instance.name == "Mock System"
コード例 #2
0
def test_software_system_instance_hydration_retrieves_software_system_from_id(
    model_with_system,
):
    """Check that the software_system instance is retrieved on hydration."""
    io = SoftwareSystemInstanceIO(
        software_system_id="19", instance_id=3, environment="Live"
    )

    instance = SoftwareSystemInstance.hydrate(io, model_with_system, parent=None)

    assert instance.instance_id == 3
    assert instance.environment == "Live"
    assert instance.software_system is model_with_system.mock_system
    assert instance.software_system_id == "19"
コード例 #3
0
def test_software_system_instance_hyrdates_http_health_checks(model_with_system):
    """Check that health checks are hydrated into the SoftwareSystemInstance."""
    health_check_io = HTTPHealthCheckIO(name="name", url="http://a.b.com")
    io = SoftwareSystemInstanceIO(
        software_system_id="19",
        instance_id=3,
        environment="Live",
        health_checks=[health_check_io],
    )

    instance = SoftwareSystemInstance.hydrate(io, model_with_system, parent=None)

    assert len(instance.health_checks) == 1
    assert list(instance.health_checks)[0].name == "name"