I have the following function that takes in a response, a CallableInterface object, and an attribute as a String.
def assert_response(response, api, expectedResponse):
# api = self.Startup
# expectedResponse = "ERROR_NOT_SUPPORTED"
eval(api + "." + expectedResponse)
The line seen above should evaluate to an attribute call as such:
self.Startup.ERROR_NOT_SUPPORTED
However, I am getting the following error because the value contained in expectedResponse is not being expanded.
AttributeError: 'CallableInterface' object has no attribute 'expectedResponse'
Any suggestions on how to work around this?