|
@@ 3015-3052 (lines=38) @@
|
| 3012 |
|
status=400, |
| 3013 |
|
) |
| 3014 |
|
|
| 3015 |
|
def test_api_put_delete_content__ok_200__nominal_case(self): |
| 3016 |
|
""" |
| 3017 |
|
delete content |
| 3018 |
|
delete Apple_pie ( content_id: 8, parent_id: 3) |
| 3019 |
|
""" |
| 3020 |
|
self.testapp.authorization = ( |
| 3021 |
|
'Basic', |
| 3022 |
|
( |
| 3023 |
|
'[email protected]', |
| 3024 |
|
'[email protected]' |
| 3025 |
|
) |
| 3026 |
|
) |
| 3027 |
|
params_active = { |
| 3028 |
|
'parent_id': 3, |
| 3029 |
|
'show_archived': 0, |
| 3030 |
|
'show_deleted': 0, |
| 3031 |
|
'show_active': 1, |
| 3032 |
|
} |
| 3033 |
|
params_deleted = { |
| 3034 |
|
'parent_id': 3, |
| 3035 |
|
'show_archived': 0, |
| 3036 |
|
'show_deleted': 1, |
| 3037 |
|
'show_active': 0, |
| 3038 |
|
} |
| 3039 |
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8 |
| 3040 |
|
deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8 |
| 3041 |
|
assert [content for content in active_contents if content['content_id'] == 8] # nopep8 |
| 3042 |
|
assert not [content for content in deleted_contents if content['content_id'] == 8] # nopep8 |
| 3043 |
|
# TODO - G.M - 2018-06-163 - Check content |
| 3044 |
|
res = self.testapp.put_json( |
| 3045 |
|
# INFO - G.M - 2018-06-163 - delete Apple_Pie |
| 3046 |
|
'/api/v2/workspaces/2/contents/8/delete', |
| 3047 |
|
status=204 |
| 3048 |
|
) |
| 3049 |
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8 |
| 3050 |
|
new_deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8 |
| 3051 |
|
assert not [content for content in new_active_contents if content['content_id'] == 8] # nopep8 |
| 3052 |
|
assert [content for content in new_deleted_contents if content['content_id'] == 8] # nopep8 |
| 3053 |
|
|
| 3054 |
|
def test_api_put_archive_content__ok_200__nominal_case(self): |
| 3055 |
|
""" |
|
@@ 3091-3126 (lines=36) @@
|
| 3088 |
|
assert not [content for content in new_active_contents if content['content_id'] == 8] # nopep8 |
| 3089 |
|
assert [content for content in new_archived_contents if content['content_id'] == 8] # nopep8 |
| 3090 |
|
|
| 3091 |
|
def test_api_put_undelete_content__ok_200__nominal_case(self): |
| 3092 |
|
""" |
| 3093 |
|
Undelete content |
| 3094 |
|
undelete Bad_Fruit_Salad ( content_id: 14, parent_id: 10) |
| 3095 |
|
""" |
| 3096 |
|
self.testapp.authorization = ( |
| 3097 |
|
'Basic', |
| 3098 |
|
( |
| 3099 |
|
'[email protected]', |
| 3100 |
|
'foobarbaz' |
| 3101 |
|
) |
| 3102 |
|
) |
| 3103 |
|
params_active = { |
| 3104 |
|
'parent_id': 10, |
| 3105 |
|
'show_archived': 0, |
| 3106 |
|
'show_deleted': 0, |
| 3107 |
|
'show_active': 1, |
| 3108 |
|
} |
| 3109 |
|
params_deleted = { |
| 3110 |
|
'parent_id': 10, |
| 3111 |
|
'show_archived': 0, |
| 3112 |
|
'show_deleted': 1, |
| 3113 |
|
'show_active': 0, |
| 3114 |
|
} |
| 3115 |
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8 |
| 3116 |
|
deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8 |
| 3117 |
|
assert not [content for content in active_contents if content['content_id'] == 14] # nopep8 |
| 3118 |
|
assert [content for content in deleted_contents if content['content_id'] == 14] # nopep8 |
| 3119 |
|
res = self.testapp.put_json( |
| 3120 |
|
'/api/v2/workspaces/2/contents/14/undelete', |
| 3121 |
|
status=204 |
| 3122 |
|
) |
| 3123 |
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8 |
| 3124 |
|
new_deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8 |
| 3125 |
|
assert [content for content in new_active_contents if content['content_id'] == 14] # nopep8 |
| 3126 |
|
assert not [content for content in new_deleted_contents if content['content_id'] == 14] # nopep8 |
| 3127 |
|
|
| 3128 |
|
def test_api_put_unarchive_content__ok_200__nominal_case(self): |
| 3129 |
|
""" |