|
@@ 4223-4260 (lines=38) @@
|
| 4220 |
|
) |
| 4221 |
|
assert res.json_body['code'] == error.WORKSPACE_DO_NOT_MATCH |
| 4222 |
|
|
| 4223 |
|
def test_api_put_delete_content__ok_200__nominal_case(self): |
| 4224 |
|
""" |
| 4225 |
|
delete content |
| 4226 |
|
delete Apple_pie ( content_id: 8, parent_id: 3) |
| 4227 |
|
""" |
| 4228 |
|
self.testapp.authorization = ( |
| 4229 |
|
'Basic', |
| 4230 |
|
( |
| 4231 |
|
'[email protected]', |
| 4232 |
|
'[email protected]' |
| 4233 |
|
) |
| 4234 |
|
) |
| 4235 |
|
params_active = { |
| 4236 |
|
'parent_id': 3, |
| 4237 |
|
'show_archived': 0, |
| 4238 |
|
'show_deleted': 0, |
| 4239 |
|
'show_active': 1, |
| 4240 |
|
} |
| 4241 |
|
params_deleted = { |
| 4242 |
|
'parent_id': 3, |
| 4243 |
|
'show_archived': 0, |
| 4244 |
|
'show_deleted': 1, |
| 4245 |
|
'show_active': 0, |
| 4246 |
|
} |
| 4247 |
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8 |
| 4248 |
|
deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8 |
| 4249 |
|
assert [content for content in active_contents if content['content_id'] == 8] # nopep8 |
| 4250 |
|
assert not [content for content in deleted_contents if content['content_id'] == 8] # nopep8 |
| 4251 |
|
# TODO - G.M - 2018-06-163 - Check content |
| 4252 |
|
res = self.testapp.put_json( |
| 4253 |
|
# INFO - G.M - 2018-06-163 - delete Apple_Pie |
| 4254 |
|
'/api/v2/workspaces/2/contents/8/trashed', |
| 4255 |
|
status=204 |
| 4256 |
|
) |
| 4257 |
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8 |
| 4258 |
|
new_deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8 |
| 4259 |
|
assert not [content for content in new_active_contents if content['content_id'] == 8] # nopep8 |
| 4260 |
|
assert [content for content in new_deleted_contents if content['content_id'] == 8] # nopep8 |
| 4261 |
|
|
| 4262 |
|
def test_api_put_archive_content__ok_200__nominal_case(self): |
| 4263 |
|
""" |
|
@@ 4299-4334 (lines=36) @@
|
| 4296 |
|
assert not [content for content in new_active_contents if content['content_id'] == 8] # nopep8 |
| 4297 |
|
assert [content for content in new_archived_contents if content['content_id'] == 8] # nopep8 |
| 4298 |
|
|
| 4299 |
|
def test_api_put_undelete_content__ok_200__nominal_case(self): |
| 4300 |
|
""" |
| 4301 |
|
Undelete content |
| 4302 |
|
undelete Bad_Fruit_Salad ( content_id: 14, parent_id: 10) |
| 4303 |
|
""" |
| 4304 |
|
self.testapp.authorization = ( |
| 4305 |
|
'Basic', |
| 4306 |
|
( |
| 4307 |
|
'[email protected]', |
| 4308 |
|
'foobarbaz' |
| 4309 |
|
) |
| 4310 |
|
) |
| 4311 |
|
params_active = { |
| 4312 |
|
'parent_id': 10, |
| 4313 |
|
'show_archived': 0, |
| 4314 |
|
'show_deleted': 0, |
| 4315 |
|
'show_active': 1, |
| 4316 |
|
} |
| 4317 |
|
params_deleted = { |
| 4318 |
|
'parent_id': 10, |
| 4319 |
|
'show_archived': 0, |
| 4320 |
|
'show_deleted': 1, |
| 4321 |
|
'show_active': 0, |
| 4322 |
|
} |
| 4323 |
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8 |
| 4324 |
|
deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8 |
| 4325 |
|
assert not [content for content in active_contents if content['content_id'] == 14] # nopep8 |
| 4326 |
|
assert [content for content in deleted_contents if content['content_id'] == 14] # nopep8 |
| 4327 |
|
res = self.testapp.put_json( |
| 4328 |
|
'/api/v2/workspaces/2/contents/14/trashed/restore', |
| 4329 |
|
status=204 |
| 4330 |
|
) |
| 4331 |
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8 |
| 4332 |
|
new_deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8 |
| 4333 |
|
assert [content for content in new_active_contents if content['content_id'] == 14] # nopep8 |
| 4334 |
|
assert not [content for content in new_deleted_contents if content['content_id'] == 14] # nopep8 |
| 4335 |
|
|
| 4336 |
|
def test_api_put_unarchive_content__ok_200__nominal_case(self): |
| 4337 |
|
""" |