|
@@ 1367-1446 (lines=80) @@
|
| 1364 |
|
assert 'code' in res.json_body |
| 1365 |
|
assert res.json_body['code'] == error.CONTENT_IN_NOT_EDITABLE_STATE |
| 1366 |
|
|
| 1367 |
|
def test_api__update_html_document__err_400__not_modified(self) -> None: |
| 1368 |
|
""" |
| 1369 |
|
Update(put) one html document of a content |
| 1370 |
|
""" |
| 1371 |
|
self.testapp.authorization = ( |
| 1372 |
|
'Basic', |
| 1373 |
|
( |
| 1374 |
|
'[email protected]', |
| 1375 |
|
'[email protected]' |
| 1376 |
|
) |
| 1377 |
|
) |
| 1378 |
|
params = { |
| 1379 |
|
'label': 'My New label', |
| 1380 |
|
'raw_content': '<p> Le nouveau contenu </p>', |
| 1381 |
|
} |
| 1382 |
|
res = self.testapp.put_json( |
| 1383 |
|
'/api/v2/workspaces/2/html-documents/6', |
| 1384 |
|
params=params, |
| 1385 |
|
status=200 |
| 1386 |
|
) |
| 1387 |
|
content = res.json_body |
| 1388 |
|
assert content['content_type'] == 'html-document' |
| 1389 |
|
assert content['content_id'] == 6 |
| 1390 |
|
assert content['is_archived'] is False |
| 1391 |
|
assert content['is_deleted'] is False |
| 1392 |
|
assert content['is_editable'] is True |
| 1393 |
|
assert content['label'] == 'My New label' |
| 1394 |
|
assert content['parent_id'] == 3 |
| 1395 |
|
assert content['show_in_ui'] is True |
| 1396 |
|
assert content['slug'] == 'my-new-label' |
| 1397 |
|
assert content['status'] == 'open' |
| 1398 |
|
assert content['workspace_id'] == 2 |
| 1399 |
|
assert content['current_revision_id'] == 28 |
| 1400 |
|
# TODO - G.M - 2018-06-173 - check date format |
| 1401 |
|
assert content['created'] |
| 1402 |
|
assert content['author'] |
| 1403 |
|
assert content['author']['user_id'] == 1 |
| 1404 |
|
assert content['author']['avatar_url'] is None |
| 1405 |
|
assert content['author']['public_name'] == 'Global manager' |
| 1406 |
|
# TODO - G.M - 2018-06-173 - check date format |
| 1407 |
|
assert content['modified'] |
| 1408 |
|
assert content['last_modifier'] == content['author'] |
| 1409 |
|
assert content['raw_content'] == '<p> Le nouveau contenu </p>' |
| 1410 |
|
|
| 1411 |
|
res = self.testapp.get( |
| 1412 |
|
'/api/v2/workspaces/2/html-documents/6', |
| 1413 |
|
status=200 |
| 1414 |
|
) |
| 1415 |
|
content = res.json_body |
| 1416 |
|
assert content['content_type'] == 'html-document' |
| 1417 |
|
assert content['content_id'] == 6 |
| 1418 |
|
assert content['is_archived'] is False |
| 1419 |
|
assert content['is_deleted'] is False |
| 1420 |
|
assert content['is_editable'] is True |
| 1421 |
|
assert content['label'] == 'My New label' |
| 1422 |
|
assert content['parent_id'] == 3 |
| 1423 |
|
assert content['show_in_ui'] is True |
| 1424 |
|
assert content['slug'] == 'my-new-label' |
| 1425 |
|
assert content['status'] == 'open' |
| 1426 |
|
assert content['workspace_id'] == 2 |
| 1427 |
|
assert content['current_revision_id'] == 28 |
| 1428 |
|
# TODO - G.M - 2018-06-173 - check date format |
| 1429 |
|
assert content['created'] |
| 1430 |
|
assert content['author'] |
| 1431 |
|
assert content['author']['user_id'] == 1 |
| 1432 |
|
assert content['author']['avatar_url'] is None |
| 1433 |
|
assert content['author']['public_name'] == 'Global manager' |
| 1434 |
|
# TODO - G.M - 2018-06-173 - check date format |
| 1435 |
|
assert content['modified'] |
| 1436 |
|
assert content['last_modifier'] == content['author'] |
| 1437 |
|
assert content['raw_content'] == '<p> Le nouveau contenu </p>' |
| 1438 |
|
|
| 1439 |
|
res = self.testapp.put_json( |
| 1440 |
|
'/api/v2/workspaces/2/html-documents/6', |
| 1441 |
|
params=params, |
| 1442 |
|
status=400 |
| 1443 |
|
) |
| 1444 |
|
assert res.json_body |
| 1445 |
|
assert 'code' in res.json_body |
| 1446 |
|
assert res.json_body['code'] == error.SAME_VALUE_ERROR |
| 1447 |
|
|
| 1448 |
|
def test_api__get_html_document_revisions__ok_200__nominal_case( |
| 1449 |
|
self |
|
@@ 5329-5408 (lines=80) @@
|
| 5326 |
|
assert content['file_extension'] == '.thread.html' |
| 5327 |
|
assert content['filename'] == 'My New label.thread.html' |
| 5328 |
|
|
| 5329 |
|
def test_api__update_thread__err_400__not_modified(self) -> None: |
| 5330 |
|
""" |
| 5331 |
|
Update(put) thread |
| 5332 |
|
""" |
| 5333 |
|
self.testapp.authorization = ( |
| 5334 |
|
'Basic', |
| 5335 |
|
( |
| 5336 |
|
'[email protected]', |
| 5337 |
|
'[email protected]' |
| 5338 |
|
) |
| 5339 |
|
) |
| 5340 |
|
params = { |
| 5341 |
|
'label': 'My New label', |
| 5342 |
|
'raw_content': '<p> Le nouveau contenu </p>', |
| 5343 |
|
} |
| 5344 |
|
res = self.testapp.put_json( |
| 5345 |
|
'/api/v2/workspaces/2/threads/7', |
| 5346 |
|
params=params, |
| 5347 |
|
status=200 |
| 5348 |
|
) |
| 5349 |
|
content = res.json_body |
| 5350 |
|
assert content['content_type'] == 'thread' |
| 5351 |
|
assert content['content_id'] == 7 |
| 5352 |
|
assert content['is_archived'] is False |
| 5353 |
|
assert content['is_deleted'] is False |
| 5354 |
|
assert content['is_editable'] is True |
| 5355 |
|
assert content['label'] == 'My New label' |
| 5356 |
|
assert content['parent_id'] == 3 |
| 5357 |
|
assert content['show_in_ui'] is True |
| 5358 |
|
assert content['slug'] == 'my-new-label' |
| 5359 |
|
assert content['status'] == 'open' |
| 5360 |
|
assert content['workspace_id'] == 2 |
| 5361 |
|
assert content['current_revision_id'] == 28 |
| 5362 |
|
# TODO - G.M - 2018-06-173 - check date format |
| 5363 |
|
assert content['created'] |
| 5364 |
|
assert content['author'] |
| 5365 |
|
assert content['author']['user_id'] == 1 |
| 5366 |
|
assert content['author']['avatar_url'] is None |
| 5367 |
|
assert content['author']['public_name'] == 'Global manager' |
| 5368 |
|
# TODO - G.M - 2018-06-173 - check date format |
| 5369 |
|
assert content['modified'] |
| 5370 |
|
assert content['last_modifier'] == content['author'] |
| 5371 |
|
assert content['raw_content'] == '<p> Le nouveau contenu </p>' |
| 5372 |
|
|
| 5373 |
|
res = self.testapp.get( |
| 5374 |
|
'/api/v2/workspaces/2/threads/7', |
| 5375 |
|
status=200 |
| 5376 |
|
) # nopep8 |
| 5377 |
|
content = res.json_body |
| 5378 |
|
assert content['content_type'] == 'thread' |
| 5379 |
|
assert content['content_id'] == 7 |
| 5380 |
|
assert content['is_archived'] is False |
| 5381 |
|
assert content['is_deleted'] is False |
| 5382 |
|
assert content['is_editable'] is True |
| 5383 |
|
assert content['label'] == 'My New label' |
| 5384 |
|
assert content['parent_id'] == 3 |
| 5385 |
|
assert content['show_in_ui'] is True |
| 5386 |
|
assert content['slug'] == 'my-new-label' |
| 5387 |
|
assert content['status'] == 'open' |
| 5388 |
|
assert content['workspace_id'] == 2 |
| 5389 |
|
assert content['current_revision_id'] == 28 |
| 5390 |
|
# TODO - G.M - 2018-06-173 - check date format |
| 5391 |
|
assert content['created'] |
| 5392 |
|
assert content['author'] |
| 5393 |
|
assert content['author']['user_id'] == 1 |
| 5394 |
|
assert content['author']['avatar_url'] is None |
| 5395 |
|
assert content['author']['public_name'] == 'Global manager' |
| 5396 |
|
# TODO - G.M - 2018-06-173 - check date format |
| 5397 |
|
assert content['modified'] |
| 5398 |
|
assert content['last_modifier'] == content['author'] |
| 5399 |
|
assert content['raw_content'] == '<p> Le nouveau contenu </p>' |
| 5400 |
|
|
| 5401 |
|
res = self.testapp.put_json( |
| 5402 |
|
'/api/v2/workspaces/2/threads/7', |
| 5403 |
|
params=params, |
| 5404 |
|
status=400 |
| 5405 |
|
) |
| 5406 |
|
assert res.json_body |
| 5407 |
|
assert 'code' in res.json_body |
| 5408 |
|
assert res.json_body['code'] == error.SAME_VALUE_ERROR |
| 5409 |
|
|
| 5410 |
|
def test_api__update_thread__err_400__empty_label(self) -> None: |
| 5411 |
|
""" |