Beispiel #1
0
 def validate_response(self,bytes_response,verification_dict):
     # Print the response first in report
     logger.info("Response Received:{0}".format(bytes_response))
     string_response = bytes_response.decode("utf-8")        # String response
     json_response = json.loads(string_response)             # Dict response
     self.total_response = json_response                     # Save to instance variable
     logger.info("Validation To be done:{0}".format(verification_dict))
     
     # Separate each key,value pair
     for response_key,response_value in verification_dict.items():
         temp_response = self.total_response
         # Key pattern processing and separating the tree of keys
         if '.' in response_key:
             split_string = response_key.split('.')
         else:
             split_string = response_key
         for item in split_string:
           temp_response = temp_response[item]
         
         # Verification of Expected response value with actually extracted response value
         if str(temp_response) != str(response_value):
             logger.error("Value expected is {0}, but found {1}".format(str(temp_response),str(response_value)))
             test_logger.fail("Values Do Not Match")
Beispiel #2
0
 def fail(self, message, *args):
     self._last_fail_exc = sys.exc_info()
     AbstractLogger.fail(self, message, *args)
Beispiel #3
0
 def fail(self, message, *args):
     self._last_fail_exc = sys.exc_info()
     AbstractLogger.fail(self, message, *args)