def test_parse_http_success_with_config_key_returns_expected_result(): resp = parse_http_success( fake_get_test(body=json.dumps({'config': 'Some Config'}))) assert resp.ok is True assert resp.data == 'Some Config' assert resp.status_code == 200 assert resp.reason == 'Success'
def test_parse_http_success_with_template_definition_key_returns_expected_result( ): resp = parse_http_success( fake_get_test( body=json.dumps({'templateDefinition': 'Some Template'}))) assert resp.ok is True assert resp.data == 'Some Template' assert resp.status_code == 200 assert resp.reason == 'Success'
def test_parse_http_success_returns_json_with_empty_data_key_returns_empty_dict( ): resp = parse_http_success(fake_get_test(body=json.dumps({'data': []}))) assert isinstance(resp.data, dict)
def test_parse_http_success_returns_with_populated_data_dict_returns_list(): resp = parse_http_success( fake_get_test(body=json.dumps({'data': [{ 'key': 'value' }]}))) assert isinstance(resp.data, list)
def test_parse_http_success_with_no_data_returns_expected_result(): resp = parse_http_success(fake_get_test()) assert resp.ok is True assert resp.data == {} assert resp.status_code == 200 assert resp.reason == 'Success'
def test_parse_http_success_returns_result_object(): resp = parse_http_success(fake_get_test()) assert isinstance(resp, Result)