Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
No-Issue
  • Loading branch information
chr-stian committed Mar 21, 2024
1 parent 26a2dba commit 4e24fc0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
6 changes: 4 additions & 2 deletions galaxy_ng/tests/integration/api/test_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import uuid

import pytest
from requests import HTTPError

from galaxykit.groups import create_group_v3, create_group, get_roles, \
delete_group_v3, get_group_v3
Expand Down Expand Up @@ -121,5 +122,6 @@ def test_group_role_listing(ansible_config, test_data):
del_group_resp = uclient.delete(f'pulp/api/v3/groups/{group_response["id"]}/')
assert del_group_resp.status_code == 204

detail_group_response = uclient.get(f'pulp/api/v3/groups/{group_response["id"]}/')
assert detail_group_response.status_code == 404
with pytest.raises(HTTPError) as ctx:
uclient.get(f'pulp/api/v3/groups/{group_response["id"]}/')
assert ctx.value.strerror.status_code == 404
17 changes: 10 additions & 7 deletions galaxy_ng/tests/integration/api/test_ui_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from orionutils.generator import build_collection
from ansible.galaxy.api import GalaxyError
from jsonschema import validate as validate_json
from requests import HTTPError

from ..constants import DEFAULT_DISTROS, USERNAME_PUBLISHER
from ..schemas import (
Expand Down Expand Up @@ -163,8 +164,9 @@ def test_api_ui_v1_collection_versions_version_range(ansible_config, uncertified
assert ds['data'][0]["version"] == c2.version

# test invalid
resp = uclient.get(f'{v_path}&version_range=not_a_semver_version')
assert resp.status_code == 400
with pytest.raises(HTTPError) as ctx:
uclient.get(f'{v_path}&version_range=not_a_semver_version')
assert ctx.value.strerror.status_code == 400


# /api/automation-hub/_ui/v1/collection-versions/{version}/
Expand Down Expand Up @@ -325,9 +327,9 @@ def test_api_ui_v1_execution_environments_registries(ansible_config):
assert resp.status_code == 204

# make sure it's gone
resp = uclient.get(f"_ui/v1/execution-environments/registries/{id}/")
assert resp.status_code == 404

with pytest.raises(HTTPError) as ctx:
uclient.get(f"_ui/v1/execution-environments/registries/{id}/")
assert ctx.value.strerror.status_code == 404

# /api/automation-hub/_ui/v1/execution-environments/registries/{pulp_id}/
# ^ tested by previous function
Expand Down Expand Up @@ -713,8 +715,9 @@ def test_api_ui_v1_remotes_by_id(ansible_config):
# FIXME - there is no suitable pulp_id for a remote?
pulp_ids = [x['pk'] for x in ds['data']]
for pulp_id in pulp_ids:
resp = uclient.get('_ui/v1/remotes/{pulp_id}/')
assert resp.status_code == 404
with pytest.raises(HTTPError) as ctx:
uclient.get('_ui/v1/remotes/{pulp_id}/')
assert ctx.value.strerror.status_code == 404


# /api/automation-hub/_ui/v1/repo/{distro_base_path}/
Expand Down

0 comments on commit 4e24fc0

Please sign in to comment.