Mercurial > p > roundup > code
comparison test/test_rest.py @ 5599:a76d88673375 REST-rebased
Added Patch operator 'action'
.. to perform actions such as 'retire'
committer: Ralf Schlatterbeck <rsc@runtux.com>
| author | Chau Nguyen <dangchau1991@yahoo.com> |
|---|---|
| date | Wed, 30 Jan 2019 10:26:35 +0100 |
| parents | 65caddd54da2 |
| children | e2c74d8121f3 |
comparison
equal
deleted
inserted
replaced
| 5598:be81e8cca38c | 5599:a76d88673375 |
|---|---|
| 459 self.assertEqual(self.dummy_client.response_code, 200) | 459 self.assertEqual(self.dummy_client.response_code, 200) |
| 460 self.assertEqual(results['attributes']['title'], None) | 460 self.assertEqual(results['attributes']['title'], None) |
| 461 self.assertEqual(len(results['attributes']['nosy']), 0) | 461 self.assertEqual(len(results['attributes']['nosy']), 0) |
| 462 self.assertEqual(results['attributes']['nosy'], []) | 462 self.assertEqual(results['attributes']['nosy'], []) |
| 463 | 463 |
| 464 def testPatchAction(self): | |
| 465 """ | |
| 466 Test Patch Action 'Action' | |
| 467 """ | |
| 468 # create a new issue with userid 1 and 2 in the nosy list | |
| 469 issue_id = self.db.issue.create(title='foo') | |
| 470 | |
| 471 # execute action retire | |
| 472 form = cgi.FieldStorage() | |
| 473 form.list = [ | |
| 474 cgi.MiniFieldStorage('op', 'action'), | |
| 475 cgi.MiniFieldStorage('action_name', 'retire') | |
| 476 ] | |
| 477 results = self.server.patch_element('issue', issue_id, form) | |
| 478 self.assertEqual(self.dummy_client.response_code, 200) | |
| 479 | |
| 480 # verify the result | |
| 481 self.assertTrue(self.db.issue.is_retired(issue_id)) | |
| 482 | |
| 464 def testPatchRemove(self): | 483 def testPatchRemove(self): |
| 465 """ | 484 """ |
| 466 Test Patch Action 'Remove' only some element from a list | 485 Test Patch Action 'Remove' only some element from a list |
| 467 """ | 486 """ |
| 468 # create a new issue with userid 1, 2, 3 in the nosy list | 487 # create a new issue with userid 1, 2, 3 in the nosy list |
