File: test_userinfo.py

package info (click to toggle)
python-globus-sdk 4.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,144 kB
  • sloc: python: 35,242; sh: 37; makefile: 35
file content (23 lines) | stat: -rw-r--r-- 656 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import pytest

import globus_sdk
from globus_sdk.testing import load_response


# TODO: add data for the success case and test it
@pytest.mark.xfail
def test_userinfo():
    raise NotImplementedError


@pytest.mark.parametrize("casename", ("unauthorized", "forbidden"))
def test_userinfo_error_handling(service_client, casename):
    meta = load_response(service_client.userinfo, case=casename).metadata

    with pytest.raises(globus_sdk.AuthAPIError) as excinfo:
        service_client.userinfo()

    err = excinfo.value
    assert err.http_status == meta["http_status"]
    assert err.code == meta["code"]
    assert err.request_id == meta["error_id"]