def test_build_results_2xx_status():
    json_data = util_load_json('test_data/User.json')
    response = util_mock_http_resp(200, json_data)
    results = SailPointIdentityIQ.build_results('IdentityIQ.Identity',
                                                'IdentityIQ.Identity',
                                                response)
    assert results.readable_output == '### Results:\n' + SailPointIdentityIQ.get_markdown(
        'IdentityIQ.Identity', json_data)
    assert results.outputs_prefix == 'IdentityIQ.Identity'
    assert results.outputs_key_field == 'IdentityIQ.Identity'
    verify_user(results.outputs)
def test_build_results_non_2xx_status():
    json_data = util_load_json('test_data/404_Not_Found.json')
    response = util_mock_http_resp(404, json_data)
    results = SailPointIdentityIQ.build_results('Test.prefix',
                                                'Test.key_field', response)
    assert results == '404 : Resource 7f000001705911b4817059d30cf50348 not found.'
def test_build_results_none():
    response = util_mock_http_resp(500, None)
    with pytest.raises(TypeError):
        SailPointIdentityIQ.build_results(None, None, response)