1+ GET http://localhost:9090/plugins/restapi/v1/users
2+ Authorization : {{ authkey }}
3+ HTTP 200
4+ [Asserts]
5+ xpath "/users/user" count == 3
6+ xpath "/users/user[username='admin']" exists
7+ xpath "/users/user[username='jane']" exists
8+ xpath "/users/user[username='john']" exists
9+ xpath "/users/user[name='John Doe']" exists
10+ xpath "/users/user[email='john.doe@example.com']" exists
11+
12+ GET http://localhost:9090/plugins/restapi/v1/users?search=john
13+ Authorization : {{ authkey }}
14+ HTTP 200
15+ [Asserts]
16+ xpath "/users/user" count == 1
17+ xpath "/users/user[username='john']" exists
18+ xpath "/users/user[name='John Doe']" exists
19+ xpath "/users/user[email='john.doe@example.com']" exists
20+
21+ # TODO: Add a user with a property to the demoboot
22+ # How to launch with custom demoboot.xml locally?
23+ #GET http://localhost:9090/plugins/restapi/v1/users?propertyKey=tea&propertyValue=earlgreyhot
24+ #Authorization: {{authkey}}
25+ #HTTP 200
26+ #[Asserts]
27+ #xpath "/users/user" count == 1
28+
29+ POST http://localhost:9090/plugins/restapi/v1/users
30+ Authorization : {{ authkey }}
31+ Content-Type : application/xml
32+ ```
33+ <?xml version="1.0" encoding="UTF-8"?>
34+ <user>
35+ <username>jeanluc</username>
36+ <name>Jean-Luc</name>
37+ <email>jlp@example.com</email>
38+ <password>makeitso</password>
39+ <properties>
40+ <property key="tea" value="earlgreyhot" />
41+ </properties>
42+ </user>
43+ ```
44+ HTTP 201
45+
46+ GET http://localhost:9090/plugins/restapi/v1/users?propertyKey=tea&propertyValue=earlgreyhot
47+ Authorization : {{ authkey }}
48+ HTTP 200
49+ [Asserts]
50+ xpath "/users/user" count == 1
51+ xpath "string(/users/user/username)" == "jeanluc"
52+ xpath "/users/user[name='Jean-Luc']" exists
53+ xpath "/users/user[email='jlp@example.com']" exists
54+ # TODO xpath for attributes
55+ xpath "/users/user/properties/property" exists
56+
57+ PUT http://localhost:9090/plugins/restapi/v1/users/jeanluc
58+ Authorization : {{ authkey }}
59+ Content-Type : application/xml
60+ ```
61+ <?xml version="1.0" encoding="UTF-8"?>
62+ <user>
63+ <username>jeanluc</username>
64+ <name>Jean-Luc</name>
65+ <email>jeanluc@example.com</email>
66+ <properties>
67+ <property key="tea" value="earlgreyhot" />
68+ </properties>
69+ </user>
70+ ```
71+ HTTP 200
72+
73+
74+ GET http://localhost:9090/plugins/restapi/v1/users/jeanluc
75+ Authorization : {{ authkey }}
76+ HTTP 200
77+ [Asserts]
78+ xpath "/user" count == 1
79+ xpath "string(/user/username)" == "jeanluc"
80+ xpath "/user[name='Jean-Luc']" exists
81+ xpath "/user[email='jlp@example.com']" not exists
82+ xpath "/user[email='jeanluc@example.com']" exists
83+
84+ DELETE http://localhost:9090/plugins/restapi/v1/users/jeanluc
85+ Authorization : {{ authkey }}
86+ HTTP 200
87+
88+ GET http://localhost:9090/plugins/restapi/v1/users/jeanluc
89+ Authorization : {{ authkey }}
90+ HTTP 404
91+ [Asserts]
92+ xpath "string(/error/exception)" == "UserNotFoundException"
93+ xpath "string(/error/message)" == "Could not get user"
94+ xpath "string(/error/resource)" == "jeanluc"
95+
96+ GET http://localhost:9090/plugins/restapi/v1/users/john/roster
97+ Authorization : {{ authkey }}
98+ HTTP 200
99+ [Asserts]
100+ xpath "/roster/rosterItem" count == 1
101+ xpath "string(/roster/rosterItem/jid)" == "jane@example.org"
102+ xpath "string(/roster/rosterItem/nickname)" == "Jane"
103+ xpath "string(/roster/rosterItem/subscriptionType)" == "3"
104+ xpath "/roster/rosterItem/groups" exists
105+
106+ # TODO: Roster add/edit/delete
107+
108+ # TODO: Group membership
109+
110+ # TODO: User lockouts
0 commit comments