From e31c838d322766488d3ab7db5d17f01184ec083b Mon Sep 17 00:00:00 2001 From: Thomas Neidhart Date: Mon, 7 Oct 2024 16:18:11 +0200 Subject: [PATCH] chore: add simple app auth test --- tests/test_app.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/test_app.py diff --git a/tests/test_app.py b/tests/test_app.py new file mode 100644 index 0000000..db27c85 --- /dev/null +++ b/tests/test_app.py @@ -0,0 +1,30 @@ +# ******************************************************************************* +# Copyright (c) 2024 Eclipse Foundation and others. +# This program and the accompanying materials are made available +# under the terms of the Eclipse Public License 2.0 +# which is available at http://www.eclipse.org/legal/epl-v20.html +# SPDX-License-Identifier: EPL-2.0 +# ******************************************************************************* +import logging + +import pytest + +from otterdog.providers.github.auth import app_auth +from otterdog.providers.github.rest import RestApi + +_logger = logging.getLogger(__name__) + +_APP_ID = "" +_APP_PRIVATE_KEY = "" + + +@pytest.mark.asyncio +@pytest.mark.skipif(not _APP_ID, reason="need to fill in app values") +async def test_list_installations(): + async with RestApi(app_auth(_APP_ID, _APP_PRIVATE_KEY)) as rest_api: + installations = await rest_api.app.get_app_installations() + + for installation in installations: + permissions = installation["permissions"] + if "merge_queue" not in permissions: + _logger.info(f"{installation['account']['login']} -> missing merge_queue permission")