Skip to content

Commit ff6a2c6

Browse files
committed
Add test of protected values for collections and item.
1 parent e99f396 commit ff6a2c6

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

test/rest_common.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,17 @@ def testOutputFormat(self):
208208
form = cgi.FieldStorage()
209209
form.list = [
210210
cgi.MiniFieldStorage('status', 'open'),
211-
cgi.MiniFieldStorage('@fields', 'nosy,status'),
211+
cgi.MiniFieldStorage('@fields', 'nosy,status,creator'),
212212
cgi.MiniFieldStorage('@verbose', '2')
213213
]
214214

215215
expected={'data':
216216
{'@total_size': 3,
217-
'collection': [
218-
{'status': {'id': '9',
217+
'collection': [ {
218+
'creator': {'id': '3',
219+
'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/user/3',
220+
'username': 'joe'},
221+
'status': {'id': '9',
219222
'name': 'open',
220223
'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/status/9'},
221224
'id': '1',
@@ -229,7 +232,10 @@ def testOutputFormat(self):
229232
],
230233
'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/issue/1',
231234
'title': 'foo1' },
232-
{'status': {
235+
{ 'creator': {'id': '3',
236+
'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/user/3',
237+
'username': 'joe'},
238+
'status': {
233239
'id': '9',
234240
'name': 'open',
235241
'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/status/9' },
@@ -241,7 +247,10 @@ def testOutputFormat(self):
241247
],
242248
'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/issue/2',
243249
'title': 'foo2'},
244-
{'status': {
250+
{'creator': {'id': '3',
251+
'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/user/3',
252+
'username': 'joe'},
253+
'status': {
245254
'id': '9',
246255
'name': 'open',
247256
'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/status/9'},
@@ -354,7 +363,7 @@ def testOutputFormat(self):
354363
## Start testing get_element
355364
form = cgi.FieldStorage()
356365
form.list = [
357-
cgi.MiniFieldStorage('@fields', 'queries,password'),
366+
cgi.MiniFieldStorage('@fields', 'queries,password,creator'),
358367
cgi.MiniFieldStorage('@verbose', '2')
359368
]
360369
expected = {'data': {
@@ -363,6 +372,9 @@ def testOutputFormat(self):
363372
'@etag': '',
364373
'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/user/3',
365374
'attributes': {
375+
'creator': {'id': '1',
376+
'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/user/1',
377+
'username': 'admin'},
366378
'password': '[password hidden scheme PBKDF2]',
367379
'queries': [],
368380
'username': 'joe'

0 commit comments

Comments
 (0)