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

Pass a list as expected_status #322

Open
gkeishin opened this issue Feb 25, 2021 · 3 comments
Open

Pass a list as expected_status #322

gkeishin opened this issue Feb 25, 2021 · 3 comments
Labels

Comments

@gkeishin
Copy link

When targeting GET on a URI if its not found / internal server error results in exception HTTPError , I can use the expected_status to override it however, it would be great if that accepts multiple values

expected_status=400,500,200

Other use cases like where example,

GET On Session  /xyz/somepath/uri   expected_status=xxx

it would raise the HTTPError if expected_status is not used and errors out

if the expected state mismatched, it raise exception as well

Url: https://xx.xx.xx.xx:443/xyz/openbmc_project/dump/ Expected status: 200 != 404

we would love to have the response than handle the exception in robot caller test code/scripts.

@lucagiove
Copy link
Member

Thanks for the suggestion of passing multiple expected values, it could be an enhancement.
I'm not sure I understood this instead:

we would love to have the response than handle the exception in robot caller test code/scripts.

If I understand properly you could specify expected_status='any' and then evaluate the response.

@lucagiove lucagiove changed the title GET HTTPError vs response code and expected_status Pass a list as expected_status Feb 25, 2021
@gkeishin
Copy link
Author

gkeishin commented Mar 1, 2021

Right for improvement.. for instance, say may be a string or list of values

expected_status=[400, 500]

or

expected_status=200, 201

something in that line which user can input. this gives us the flexibility to be able to anticipate multiple valid return codes from the server.

plus if it doesn't get the expected status, we would want to get return response if errors/mismatched execrated status and not exception which is currently happening.

example:

resp=  GET On Session  /xyz/somepath/uri   expected_status=201

resp we would want this response if it errors/mismatched, but currently its throwing exception and not proceeding further a.

@lucagiove
Copy link
Member

As said you could pass 'any' as expected status in order not to let the keyword fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants