def test_tapi_token(self): test_output_so_far = { 'main': { 'response': { 'headers': { 'auth-token': '*' } } } } value = '[[token:main.response.headers.auth-token]]' self.assertEqual(TapiExprEvaluator.normalize_request_tapi_expr(value, test_output_so_far, {}), '*')
def test_tapi_env_var(self): os.environ['FOOBAR'] = 'foobar' value = '[[env:$FOOBAR]]' self.assertEqual(TapiExprEvaluator.normalize_request_tapi_expr(value, {}, {}), 'foobar')
def test_tapi_request_script(self): value = '[[script:request_test_id_headers_authorization.py]]' self.assertEqual(TapiExprEvaluator.normalize_request_tapi_expr(value, {}, {}), 'hello auth header')
def test_tapi_response_script(self): value = '[[script:response_test_id_body.py]]' self.assertEqual(TapiExprEvaluator.get_response_tapi_expr(value, {}, {}, None), True)
def test_is_tapi_expr(self): self.assertEqual(TapiExprEvaluator.is_tapi_expr('[[]]'), True) self.assertEqual(TapiExprEvaluator.is_tapi_expr('[]'), False) self.assertEqual(TapiExprEvaluator.is_tapi_expr('[['), False) self.assertEqual(TapiExprEvaluator.is_tapi_expr(']]'), False)