Files
galaxy/test/integration/cloudauthz/test_cloudauthz.py
T
Nicola Soranzo 30f60493c3 Format Python code with black 23.1.0
with manual fixes to 3 files to make them compatible with black 22.12.0 .

We need to keep black pinned at `<23` until we vendorise `packaging`, since
the new version of black depends on `packaging >=22.0` which is the version
where `LegacyVersion` (which we use for tool lineages) was removed.
2023-02-01 23:51:03 +00:00

36 lines
1.1 KiB
Python

"""
You may run this test using the following command:
./run_tests.sh test/integration/cloudauthz/test_cloudauthz.py:TestDefineCloudAuthz.test_post_cloudauthz_without_authn -s
"""
import json
from galaxy_test.driver import integration_util
class TestDefineCloudAuthz(integration_util.IntegrationTestCase):
framework_tool_and_types = True
def test_post_cloudauthz_without_authn(self):
"""
This test asserts if a cloudauthz object
can be successfully posted to the cloudauthz API
(i.e., api/cloud/authz).
"""
provider = "azure"
tenant_id = "abc"
client_id = "def"
client_secret = "ghi"
with self._different_user("vahid@test.com"):
# The payload for the POST API.
payload = {
"provider": provider,
"config": json.dumps({"tenant_id": tenant_id, "client_id": client_id, "client_secret": client_secret}),
}
response = self._post(path="cloud/authz", data=payload)
response.raise_for_status()
cloudauthz = response.json()
assert cloudauthz["provider"] == provider