Ejemplo n.º 1
0
def test_healthcheck_action_fails_if_database_not_found():
    clear_expectations()
    clear()

    settings_health_check.Ion = Fake('Ion')
    settings_health_check.Ion.healthcheck_text = None

    fake_server_health_check = Fake('server')
    controller = Controller()
    controller.server = fake_server_health_check

    fake_server_health_check.expects('test_connection').returns(False)
    fake_server_health_check.test_connection_error = ValueError('Fake error')

    try:
        controller.healthcheck()
    except RuntimeError, err:
        assert str(err) == "The connection to the database failed with error: Fake error"
        return
Ejemplo n.º 2
0
def test_healthcheck_action_returns_working_if_no_text_in_config():
    clear_expectations()
    clear()

    settings_health_check.Ion = Fake('Ion')
    settings_health_check.Ion.healthcheck_text = None

    fake_server_health_check = Fake('server')
    fake_server_health_check.expects('test_connection').returns(True)

    controller = Controller()
    controller.server = fake_server_health_check

    assert controller.healthcheck() == "WORKING"
Ejemplo n.º 3
0
def test_healthcheck_action():
    clear_expectations()
    clear()

    settings_health_check.Ion = Fake('Ion')
    settings_health_check.Ion.healthcheck_text = "CUSTOMTEXT"

    fake_server_health_check = Fake('server')
    fake_server_health_check.expects('test_connection').returns(True)

    controller = Controller()
    controller.server = fake_server_health_check

    assert controller.healthcheck() == "CUSTOMTEXT"