Skip to content

Commit

Permalink
Verify type of paramater pulp_version in bug_is_fixed
Browse files Browse the repository at this point in the history
Verify what type of parameter is provided to the function `bug_is_fixed`
to assure that `pulp_version` is a valid choice.
  • Loading branch information
koliveir authored and rochacbruno committed Apr 15, 2019
1 parent 39902d7 commit b0a3e8a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pulp_smash/selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,17 @@ def bug_is_fixed(bug_id, pulp_version):
warnings.warn(message, RuntimeWarning)
return True

if isinstance(pulp_version, str):
pulp_version = Version(pulp_version)

if not isinstance(pulp_version, Version):
raise TypeError(
"Pulp version should be an instance of Version. The given"
" Pulp version, {} is a {}.".format(
pulp_version, type(pulp_version)
)
)

# bug.target_platform_release has already been verified by Version().
if bug.status not in _TESTABLE_BUGS | _UNTESTABLE_BUGS:
raise exceptions.BugStatusUnknownError(
Expand Down

0 comments on commit b0a3e8a

Please sign in to comment.