Пример #1
0
def test_get_application_internal_server_error():
    responses.add(
        responses.GET, "http://marathon.somedomain.com:8080/v2/apps/test-app", status=500, body="Internal Server Error"
    )

    client = MarathonClient("http://marathon.somedomain.com:8080")
    with pytest.raises(ClientError):
        client.get_application("test-app")
Пример #2
0
def test_get_application_internal_server_error():
    responses.add(responses.GET,
                  'http://marathon.somedomain.com:8080/v2/apps/test-app',
                  status=500,
                  body="Internal Server Error")

    client = MarathonClient("http://marathon.somedomain.com:8080")
    with pytest.raises(ClientError):
        client.get_application('test-app')
Пример #3
0
def test_get_application_not_found():
    responses.add(responses.GET,
                  'http://marathon.somedomain.com:8080/v2/apps/test-app',
                  status=404,
                  json={"message": "App '/test-app' does not exist"})

    client = MarathonClient("http://marathon.somedomain.com:8080")
    with pytest.raises(ClientError):
        client.get_application('test-app')
Пример #4
0
def test_basic_auth_headers_not_present():
    responses.add(responses.GET,
                  'http://marathon.somedomain.com:8080/v2/apps/test-app',
                  status=200,
                  json=_load_json_fixture("valid_app"))

    client = MarathonClient("http://marathon.somedomain.com:8080")
    client.get_application('test-app')

    assert "Authorization" not in responses.calls[0].request.headers
Пример #5
0
def test_get_application_not_found():
    responses.add(
        responses.GET,
        "http://marathon.somedomain.com:8080/v2/apps/test-app",
        status=404,
        json={"message": "App '/test-app' does not exist"},
    )

    client = MarathonClient("http://marathon.somedomain.com:8080")
    with pytest.raises(ClientError):
        client.get_application("test-app")
Пример #6
0
def test_get_application():
    responses.add(responses.GET,
                  'http://marathon.somedomain.com:8080/v2/apps/test-app',
                  status=200,
                  json=_load_json_fixture("valid_app"))

    client = MarathonClient("http://marathon.somedomain.com:8080")
    application = client.get_application('test-app')
    assert application['id'] == "/test-app"
    assert application['cmd'] is None
Пример #7
0
def test_get_application():
    responses.add(
        responses.GET,
        "http://marathon.somedomain.com:8080/v2/apps/test-app",
        status=200,
        json=_load_json_fixture("valid_app"),
    )

    client = MarathonClient("http://marathon.somedomain.com:8080")
    application = client.get_application("test-app")
    assert application["id"] == "/test-app"
    assert application["cmd"] is None