@@ 3504-3541 (lines=38) @@ | ||
3501 | status=400, |
|
3502 | ) |
|
3503 | ||
3504 | def test_api_put_delete_content__ok_200__nominal_case(self): |
|
3505 | """ |
|
3506 | delete content |
|
3507 | delete Apple_pie ( content_id: 8, parent_id: 3) |
|
3508 | """ |
|
3509 | self.testapp.authorization = ( |
|
3510 | 'Basic', |
|
3511 | ( |
|
3512 | '[email protected]', |
|
3513 | '[email protected]' |
|
3514 | ) |
|
3515 | ) |
|
3516 | params_active = { |
|
3517 | 'parent_id': 3, |
|
3518 | 'show_archived': 0, |
|
3519 | 'show_deleted': 0, |
|
3520 | 'show_active': 1, |
|
3521 | } |
|
3522 | params_deleted = { |
|
3523 | 'parent_id': 3, |
|
3524 | 'show_archived': 0, |
|
3525 | 'show_deleted': 1, |
|
3526 | 'show_active': 0, |
|
3527 | } |
|
3528 | active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8 |
|
3529 | deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8 |
|
3530 | assert [content for content in active_contents if content['content_id'] == 8] # nopep8 |
|
3531 | assert not [content for content in deleted_contents if content['content_id'] == 8] # nopep8 |
|
3532 | # TODO - G.M - 2018-06-163 - Check content |
|
3533 | res = self.testapp.put_json( |
|
3534 | # INFO - G.M - 2018-06-163 - delete Apple_Pie |
|
3535 | '/api/v2/workspaces/2/contents/8/delete', |
|
3536 | status=204 |
|
3537 | ) |
|
3538 | new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8 |
|
3539 | new_deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8 |
|
3540 | assert not [content for content in new_active_contents if content['content_id'] == 8] # nopep8 |
|
3541 | assert [content for content in new_deleted_contents if content['content_id'] == 8] # nopep8 |
|
3542 | ||
3543 | def test_api_put_archive_content__ok_200__nominal_case(self): |
|
3544 | """ |
|
@@ 3580-3615 (lines=36) @@ | ||
3577 | assert not [content for content in new_active_contents if content['content_id'] == 8] # nopep8 |
|
3578 | assert [content for content in new_archived_contents if content['content_id'] == 8] # nopep8 |
|
3579 | ||
3580 | def test_api_put_undelete_content__ok_200__nominal_case(self): |
|
3581 | """ |
|
3582 | Undelete content |
|
3583 | undelete Bad_Fruit_Salad ( content_id: 14, parent_id: 10) |
|
3584 | """ |
|
3585 | self.testapp.authorization = ( |
|
3586 | 'Basic', |
|
3587 | ( |
|
3588 | '[email protected]', |
|
3589 | 'foobarbaz' |
|
3590 | ) |
|
3591 | ) |
|
3592 | params_active = { |
|
3593 | 'parent_id': 10, |
|
3594 | 'show_archived': 0, |
|
3595 | 'show_deleted': 0, |
|
3596 | 'show_active': 1, |
|
3597 | } |
|
3598 | params_deleted = { |
|
3599 | 'parent_id': 10, |
|
3600 | 'show_archived': 0, |
|
3601 | 'show_deleted': 1, |
|
3602 | 'show_active': 0, |
|
3603 | } |
|
3604 | active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8 |
|
3605 | deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8 |
|
3606 | assert not [content for content in active_contents if content['content_id'] == 14] # nopep8 |
|
3607 | assert [content for content in deleted_contents if content['content_id'] == 14] # nopep8 |
|
3608 | res = self.testapp.put_json( |
|
3609 | '/api/v2/workspaces/2/contents/14/undelete', |
|
3610 | status=204 |
|
3611 | ) |
|
3612 | new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8 |
|
3613 | new_deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8 |
|
3614 | assert [content for content in new_active_contents if content['content_id'] == 14] # nopep8 |
|
3615 | assert not [content for content in new_deleted_contents if content['content_id'] == 14] # nopep8 |
|
3616 | ||
3617 | def test_api_put_unarchive_content__ok_200__nominal_case(self): |
|
3618 | """ |