Fix _validate_switch_role throwing incorrect error message

Currently, if switch_role in rbac_utils is not called correctly
(or not at all), then a role switch error is thrown. It is only
not thrown if a skip exception is currently being handled--that is,
if the test is skipped, then the validation is ignored.

However, this logic is not entirely correct. For example, when
an unexpected error is thrown, like an AttributeError, then the
validation check fails, and so a role switch error is thrown -- when
instead the AttributeError should be thrown instead.

This patch changes the behavior of _validate_switch_role to only
throw a switch role error if no other exception is currently
being handled.

Change-Id: I8c3944e766210a31aa684e29c45e39470b738640
2 files changed