コード例 #1
0
 def test_retrieve_value_from_response_invalid_key(self):
     keys = ["d.e.f", 'g.h']
     resp_msg = {
         "a": {
             "b": {
                 "3": 2,
                 "43": 30,
                 "c": [],
                 "d": ['red', 'buggy', 'bumpers'],
             }
         }
     }
     try:
         ActionUtility.retrieve_value_from_response(keys, resp_msg)
         assert False
     except HttpActionFailure as e:
         assert str(e) == 'Unable to retrieve value for key from HTTP response: \'d\''
コード例 #2
0
ファイル: action_test.py プロジェクト: Anitej/kairon
 def test_retrieve_value_from_response(self):
     keys = ["a.b.3", 'a.b']
     resp_msg = {
         "a": {
             "b": {
                 "3": 2,
                 "43": 30,
                 "c": [],
                 "d": ['red', 'buggy', 'bumpers'],
             }
         }
     }
     key_values = ActionUtility.retrieve_value_from_response(keys, resp_msg)
     assert key_values is not None
     assert key_values['${a.b.3}'] == 2
     assert key_values['${a.b}'] is not None
     assert key_values['${a.b}']['3'] == 2
     assert key_values['${a.b}']['d'][0] == 'red'