Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

non existent APIResponseError #17406

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions robottelo/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
"""Custom Errors for Robottelo"""


class APIResponseError(Exception):
"""Indicates wrong API response"""


class GCECertNotFoundError(Exception):
"""An exception to raise when GCE Cert json is not available for creating GCE CR"""

Expand Down
13 changes: 6 additions & 7 deletions robottelo/host_helpers/api_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
DEFAULT_ARCHITECTURE,
REPO_TYPE,
)
from robottelo.exceptions import APIResponseError
from robottelo.host_helpers.repository_mixins import initiate_repo_helpers


Expand Down Expand Up @@ -206,14 +207,14 @@ def create_role_permissions(
query={'search': f'name="{name}"'}
)
if not result:
raise self._satellite.api.APIResponseError(f'permission "{name}" not found')
raise APIResponseError(f'permission "{name}" not found')
if len(result) > 1:
raise self._satellite.api.APIResponseError(
raise APIResponseError(
f'found more than one entity for permission "{name}"'
)
entity_permission = result[0]
if entity_permission.name != name:
raise self._satellite.api.APIResponseError(
raise APIResponseError(
'the returned permission is different from the'
f' requested one "{entity_permission.name} != {name}"'
)
Expand All @@ -229,9 +230,7 @@ def create_role_permissions(
query={'per_page': '350', 'search': f'resource_type="{resource_type}"'}
)
if not resource_type_permissions_entities:
raise self._satellite.api.APIResponseError(
f'resource type "{resource_type}" permissions not found'
)
raise APIResponseError(f'resource type "{resource_type}" permissions not found')

permissions_entities = [
entity
Expand All @@ -243,7 +242,7 @@ def create_role_permissions(
permissions_entities_names = {entity.name for entity in permissions_entities}
not_found_names = set(permissions_name).difference(permissions_entities_names)
if not_found_names:
raise self._satellite.api.APIResponseError(
raise APIResponseError(
f'permissions names entities not found "{not_found_names}"'
)
self._satellite.api.Filter(
Expand Down
Loading