a
*Na @ s d Z ddlZddlZddlmZmZmZ ejdd Zejdd Z ejdd Z
ejd
d Zejdd
Zejdd Z
ejdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd ZdS ) z7
GitLab API: https://docs.gitlab.com/ce/api/users.html
N)UserUserMembership
UserStatusc c sX dddddd} t ,}|jt jd| dd d
|V W d n1 sJ0 Y d S )Nname passwordusernameemail)r idr r r zhttp://localhost/api/v4/users/1application/json methodurljsoncontent_typestatus responsesRequestsMockaddGETcontentrsps r x/private/var/folders/js/6pj4vh5d4zd0k6bxv74qrbhr0000gr/T/pip-target-22xwyzbs/lib/python/tests/unit/objects/test_users.py
resp_get_user
s
r c c sd ddddddddddg} t ,}|jt jd | d
dd |V W d n1 sV0 Y d S )
Nr zProject oneProjectZ20)Z source_idZsource_namesource_typeZaccess_level zGroup threeZ Namespacez+http://localhost/api/v4/users/1/membershipsr r r
r r r r r resp_get_user_memberships s(
r! c c sb t jddB} | jt jdi ddd | jt jdi ddd | V W d n1 sT0 Y d S )NF)Zassert_all_requests_are_firedz(http://localhost/api/v4/users/1/activater r
z*http://localhost/api/v4/users/1/deactivater r r POST)r r r r
resp_activate; s r% c c sT dddd} t ,}|jt jd| ddd |V W d n1 sF0 Y d S ) Ntestz
Message
thumbsup)messageZmessage_htmlemojiz&http://localhost/api/v4/users/1/statusr r r
r r r r r resp_get_user_statusO s
r* c c sH t ,}|jt jd| ddd |V W d n1 s:0 Y d S )Nz8http://localhost/api/v4/users/1/identities/test_providerr r
)r r r DELETE)
no_contentr r r r resp_delete_user_identityb s
r. c c sp ddddddd} t B}|jt jd| d d
d |jt jd| d d
d |V W d n1 sb0 Y d S )
Nr Z
john_smithz
John Smithactivez4http://localhost:3000/uploads/user/avatar/1/cd8.jpegz http://localhost:3000/john_smith)r
r r state
avatar_urlweb_urlz&http://localhost/api/v4/users/1/followr r" r
z(http://localhost/api/v4/users/1/unfollowr# )userr r r r resp_follow_unfollowo s.
r4 c c s ddddddddd d
ddddg} t B}|jt jd
| ddd |jt jd| ddd |V W d n1 st0 Y d S )N zLennie Donnellyzevette.kilbackr/ zQhttps://www.gravatar.com/avatar/7955171a55ac4997ed81e5976287890a?s=80&d=identiconz$http://127.0.0.1:3000/evette.kilback)r
r r r0 r1 r2 zSerena BradtkeZcammyzQhttps://www.gravatar.com/avatar/a2daad869a7b60d3090b7b9bef4baf57?s=80&d=identiconzhttp://127.0.0.1:3000/cammyz)http://localhost/api/v4/users/1/followersr r r
z)http://localhost/api/v4/users/1/followingr r r r r resp_followers_following s>
r7 c C s: | j d}t|tsJ |jdks(J |jdks6J d S )Nr r )Zusersget
isinstancer r r
)glr r3 r r r
test_get_user s r; c C s2 | j }t|d tsJ |d jdks.J d S )Nr r )membershipslistr9 r r )r3 r! r<