diff --git a/post-deployment/features/tango_tools.feature b/post-deployment/features/tango_tools.feature index 836de112f05624801d8084e4334c994cd763d34a..cac0436e3c0197c8fae2672d6b2c3acf2989bb9d 100644 --- a/post-deployment/features/tango_tools.feature +++ b/post-deployment/features/tango_tools.feature @@ -13,5 +13,5 @@ Scenario: Test starting itango session Scenario: Test REST interface Given the TANGO_HOST is defined in the environment - When I make a request with user tango-cs:tango to http://tango-base-tango-rest:8080/tango/rest/rc4/hosts/databaseds/10000/devices/sys/tg_test/1/attributes/boolean_scalar/value + When I make a request with user tango-cs:tango to http://tango-base-tango-rest:8080/tango/rest/rc4/hosts/TANGO_HOST/10000/devices/sys/tg_test/1/attributes/boolean_scalar/value Then the return code is 200 \ No newline at end of file diff --git a/post-deployment/tests/test_tango_tools.py b/post-deployment/tests/test_tango_tools.py index 828c4c0a81cabf82e38c5f50da1350637d9c8d5f..8591669dfad87ee0b06482e3333adc199f9662d3 100644 --- a/post-deployment/tests/test_tango_tools.py +++ b/post-deployment/tests/test_tango_tools.py @@ -30,22 +30,25 @@ def call_command(command, parameter): @when(parsers.parse("I make a request with user {basic_auth} to {address}")) -def curl_rest(basic_auth, address): +def curl_rest(run_context, basic_auth, address): """Request basic attribute from test device""" pytest.result = subprocess.run(["curl", "--user", basic_auth, address]) - url = address + url = address.replace('TANGO_HOST',run_context.TANGO_HOST.split(':')[0]) + logging.info("Request sent to {}".format(url)) + auth_tuple = (basic_auth.split(':')[0], basic_auth.split(':')[1]) pytest.result = requests.get(url, auth=auth_tuple) + logging.info("Result text: {}".format(pytest.result.text)) @then(parsers.parse('the return code is {expected_result}')) def check_return_code(expected_result): """the return code is as expected.""" # return_code = call_command.returncode - if expected_result == 200: - assert pytest.result.status_code == expected_result, "Curl returned {}, expected {}".format(pytest.result, expected_result) + if expected_result == '200': + assert pytest.result.status_code == int(expected_result), "Curl returned {}, expected {}".format(pytest.result, expected_result) else: return_code = pytest.result.returncode assert str(return_code) == str(expected_result), "Function returned {}, expected {}".format(pytest.result, expected_result)