Skip to content
Snippets Groups Projects
Commit d7d37f62 authored by Adriaan de Beer's avatar Adriaan de Beer
Browse files

ST-456 upgraded REST tests

parent d42c6592
No related branches found
No related tags found
No related merge requests found
......@@ -15,3 +15,5 @@ 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/TANGO_HOST/10000/devices/sys/tg_test/1/attributes/boolean_scalar/value
Then the return code is 200
And the result quality is ATTR_VALID
And the result name is boolean_scalar
\ No newline at end of file
......@@ -41,6 +41,7 @@ def curl_rest(run_context, basic_auth, address):
pytest.result = requests.get(url, auth=auth_tuple)
logging.info("Result text: {}".format(pytest.result.text))
logging.info("Result json: {}".format(pytest.result.json()))
@then(parsers.parse('the return code is {expected_result}'))
......@@ -49,8 +50,14 @@ def check_return_code(expected_result):
# return_code = call_command.returncode
if expected_result == '200':
assert pytest.result.status_code == int(expected_result), "Curl returned {}, expected {}".format(pytest.result, expected_result)
assert pytest.result.json()['quality'] == 'ATTR_VALID'
else:
return_code = pytest.result.returncode
assert str(return_code) == str(expected_result), "Function returned {}, expected {}".format(pytest.result, expected_result)
@then(parsers.parse('the result {key} is {value}'))
def check_result(key,value):
"""result is as expected"""
assert pytest.result.json()[key] == value
scenarios('../features/tango_tools.feature')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment