Mercurial > p > roundup > code
comparison test/rest_common.py @ 5825:bcb894bc9740
Add test of protected values for collections and item.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 23 Jun 2019 21:21:51 -0400 |
| parents | ddb553d5618c |
| children | 9c6617857032 |
comparison
equal
deleted
inserted
replaced
| 5824:352e78c3b4ab | 5825:bcb894bc9740 |
|---|---|
| 206 | 206 |
| 207 # Check formating for issues status=open; @fields and verbose tests | 207 # Check formating for issues status=open; @fields and verbose tests |
| 208 form = cgi.FieldStorage() | 208 form = cgi.FieldStorage() |
| 209 form.list = [ | 209 form.list = [ |
| 210 cgi.MiniFieldStorage('status', 'open'), | 210 cgi.MiniFieldStorage('status', 'open'), |
| 211 cgi.MiniFieldStorage('@fields', 'nosy,status'), | 211 cgi.MiniFieldStorage('@fields', 'nosy,status,creator'), |
| 212 cgi.MiniFieldStorage('@verbose', '2') | 212 cgi.MiniFieldStorage('@verbose', '2') |
| 213 ] | 213 ] |
| 214 | 214 |
| 215 expected={'data': | 215 expected={'data': |
| 216 {'@total_size': 3, | 216 {'@total_size': 3, |
| 217 'collection': [ | 217 'collection': [ { |
| 218 {'status': {'id': '9', | 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', | |
| 219 'name': 'open', | 222 'name': 'open', |
| 220 'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/status/9'}, | 223 'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/status/9'}, |
| 221 'id': '1', | 224 'id': '1', |
| 222 'nosy': [ | 225 'nosy': [ |
| 223 {'username': 'admin', | 226 {'username': 'admin', |
| 227 'id': '2', | 230 'id': '2', |
| 228 'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/user/2'} | 231 'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/user/2'} |
| 229 ], | 232 ], |
| 230 'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/issue/1', | 233 'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/issue/1', |
| 231 'title': 'foo1' }, | 234 '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': { | |
| 233 'id': '9', | 239 'id': '9', |
| 234 'name': 'open', | 240 'name': 'open', |
| 235 'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/status/9' }, | 241 'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/status/9' }, |
| 236 'id': '2', | 242 'id': '2', |
| 237 'nosy': [ | 243 'nosy': [ |
| 239 'id': '3', | 245 'id': '3', |
| 240 'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/user/3'} | 246 'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/user/3'} |
| 241 ], | 247 ], |
| 242 'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/issue/2', | 248 'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/issue/2', |
| 243 'title': 'foo2'}, | 249 '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': { | |
| 245 'id': '9', | 254 'id': '9', |
| 246 'name': 'open', | 255 'name': 'open', |
| 247 'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/status/9'}, | 256 'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/status/9'}, |
| 248 'id': '3', | 257 'id': '3', |
| 249 'nosy': [], | 258 'nosy': [], |
| 352 self.assertDictEqual(expected, results) | 361 self.assertDictEqual(expected, results) |
| 353 | 362 |
| 354 ## Start testing get_element | 363 ## Start testing get_element |
| 355 form = cgi.FieldStorage() | 364 form = cgi.FieldStorage() |
| 356 form.list = [ | 365 form.list = [ |
| 357 cgi.MiniFieldStorage('@fields', 'queries,password'), | 366 cgi.MiniFieldStorage('@fields', 'queries,password,creator'), |
| 358 cgi.MiniFieldStorage('@verbose', '2') | 367 cgi.MiniFieldStorage('@verbose', '2') |
| 359 ] | 368 ] |
| 360 expected = {'data': { | 369 expected = {'data': { |
| 361 'id': '3', | 370 'id': '3', |
| 362 'type': 'user', | 371 'type': 'user', |
| 363 '@etag': '', | 372 '@etag': '', |
| 364 'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/user/3', | 373 'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/user/3', |
| 365 'attributes': { | 374 'attributes': { |
| 375 'creator': {'id': '1', | |
| 376 'link': 'http://tracker.example/cgi-bin/roundup.cgi/bugs/rest/data/user/1', | |
| 377 'username': 'admin'}, | |
| 366 'password': '[password hidden scheme PBKDF2]', | 378 'password': '[password hidden scheme PBKDF2]', |
| 367 'queries': [], | 379 'queries': [], |
| 368 'username': 'joe' | 380 'username': 'joe' |
| 369 } | 381 } |
| 370 }} | 382 }} |
