|
@@ 2585-2626 (lines=42) @@
|
| 2582 |
|
status=400 |
| 2583 |
|
) |
| 2584 |
|
|
| 2585 |
|
def test_api__post_content_create_generic_content__ok_200__in_folder(self) -> None: # nopep8 |
| 2586 |
|
""" |
| 2587 |
|
Create generic content in folder |
| 2588 |
|
""" |
| 2589 |
|
self.testapp.authorization = ( |
| 2590 |
|
'Basic', |
| 2591 |
|
( |
| 2592 |
|
'[email protected]', |
| 2593 |
|
'[email protected]' |
| 2594 |
|
) |
| 2595 |
|
) |
| 2596 |
|
params = { |
| 2597 |
|
'label': 'GenericCreatedContent', |
| 2598 |
|
'content_type': 'html-document', |
| 2599 |
|
'parent_id': 10, |
| 2600 |
|
} |
| 2601 |
|
res = self.testapp.post_json( |
| 2602 |
|
'/api/v2/workspaces/1/contents', |
| 2603 |
|
params=params, |
| 2604 |
|
status=200 |
| 2605 |
|
) |
| 2606 |
|
assert res |
| 2607 |
|
assert res.json_body |
| 2608 |
|
assert res.json_body['status'] == 'open' |
| 2609 |
|
assert res.json_body['content_id'] |
| 2610 |
|
assert res.json_body['content_type'] == 'html-document' |
| 2611 |
|
assert res.json_body['is_archived'] is False |
| 2612 |
|
assert res.json_body['is_deleted'] is False |
| 2613 |
|
assert res.json_body['workspace_id'] == 1 |
| 2614 |
|
assert res.json_body['slug'] == 'genericcreatedcontent' |
| 2615 |
|
assert res.json_body['parent_id'] == 10 |
| 2616 |
|
assert res.json_body['show_in_ui'] is True |
| 2617 |
|
assert res.json_body['sub_content_types'] |
| 2618 |
|
params_active = { |
| 2619 |
|
'parent_id': 10, |
| 2620 |
|
'show_archived': 0, |
| 2621 |
|
'show_deleted': 0, |
| 2622 |
|
'show_active': 1, |
| 2623 |
|
} |
| 2624 |
|
# INFO - G.M - 2018-06-165 - Verify if new content is correctly created |
| 2625 |
|
active_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_active, status=200).json_body # nopep8 |
| 2626 |
|
assert res.json_body in active_contents |
| 2627 |
|
|
| 2628 |
|
def test_api__post_content_create_generic_content__err_400__empty_label(self) -> None: # nopep8 |
| 2629 |
|
""" |
|
@@ 2478-2519 (lines=42) @@
|
| 2475 |
|
assert 'message' in res.json.keys() |
| 2476 |
|
assert 'details' in res.json.keys() |
| 2477 |
|
|
| 2478 |
|
def test_api__post_content_create_generic_content__ok_200__nominal_case(self) -> None: # nopep8 |
| 2479 |
|
""" |
| 2480 |
|
Create generic content |
| 2481 |
|
""" |
| 2482 |
|
self.testapp.authorization = ( |
| 2483 |
|
'Basic', |
| 2484 |
|
( |
| 2485 |
|
'[email protected]', |
| 2486 |
|
'[email protected]' |
| 2487 |
|
) |
| 2488 |
|
) |
| 2489 |
|
params = { |
| 2490 |
|
'parent_id': None, |
| 2491 |
|
'label': 'GenericCreatedContent', |
| 2492 |
|
'content_type': 'html-document', |
| 2493 |
|
} |
| 2494 |
|
res = self.testapp.post_json( |
| 2495 |
|
'/api/v2/workspaces/1/contents', |
| 2496 |
|
params=params, |
| 2497 |
|
status=200 |
| 2498 |
|
) |
| 2499 |
|
assert res |
| 2500 |
|
assert res.json_body |
| 2501 |
|
assert res.json_body['status'] == 'open' |
| 2502 |
|
assert res.json_body['content_id'] |
| 2503 |
|
assert res.json_body['content_type'] == 'html-document' |
| 2504 |
|
assert res.json_body['is_archived'] is False |
| 2505 |
|
assert res.json_body['is_deleted'] is False |
| 2506 |
|
assert res.json_body['workspace_id'] == 1 |
| 2507 |
|
assert res.json_body['slug'] == 'genericcreatedcontent' |
| 2508 |
|
assert res.json_body['parent_id'] is None |
| 2509 |
|
assert res.json_body['show_in_ui'] is True |
| 2510 |
|
assert res.json_body['sub_content_types'] |
| 2511 |
|
params_active = { |
| 2512 |
|
'parent_id': 0, |
| 2513 |
|
'show_archived': 0, |
| 2514 |
|
'show_deleted': 0, |
| 2515 |
|
'show_active': 1, |
| 2516 |
|
} |
| 2517 |
|
# INFO - G.M - 2018-06-165 - Verify if new content is correctly created |
| 2518 |
|
active_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_active, status=200).json_body # nopep8 |
| 2519 |
|
assert res.json_body in active_contents |
| 2520 |
|
|
| 2521 |
|
def test_api__post_content_create_generic_content__ok_200__no_parent_id_param(self) -> None: # nopep8 |
| 2522 |
|
""" |
|
@@ 2521-2561 (lines=41) @@
|
| 2518 |
|
active_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_active, status=200).json_body # nopep8 |
| 2519 |
|
assert res.json_body in active_contents |
| 2520 |
|
|
| 2521 |
|
def test_api__post_content_create_generic_content__ok_200__no_parent_id_param(self) -> None: # nopep8 |
| 2522 |
|
""" |
| 2523 |
|
Create generic content |
| 2524 |
|
""" |
| 2525 |
|
self.testapp.authorization = ( |
| 2526 |
|
'Basic', |
| 2527 |
|
( |
| 2528 |
|
'[email protected]', |
| 2529 |
|
'[email protected]' |
| 2530 |
|
) |
| 2531 |
|
) |
| 2532 |
|
params = { |
| 2533 |
|
'label': 'GenericCreatedContent', |
| 2534 |
|
'content_type': 'html-document', |
| 2535 |
|
} |
| 2536 |
|
res = self.testapp.post_json( |
| 2537 |
|
'/api/v2/workspaces/1/contents', |
| 2538 |
|
params=params, |
| 2539 |
|
status=200 |
| 2540 |
|
) |
| 2541 |
|
assert res |
| 2542 |
|
assert res.json_body |
| 2543 |
|
assert res.json_body['status'] == 'open' |
| 2544 |
|
assert res.json_body['content_id'] |
| 2545 |
|
assert res.json_body['content_type'] == 'html-document' |
| 2546 |
|
assert res.json_body['is_archived'] is False |
| 2547 |
|
assert res.json_body['is_deleted'] is False |
| 2548 |
|
assert res.json_body['workspace_id'] == 1 |
| 2549 |
|
assert res.json_body['slug'] == 'genericcreatedcontent' |
| 2550 |
|
assert res.json_body['parent_id'] is None |
| 2551 |
|
assert res.json_body['show_in_ui'] is True |
| 2552 |
|
assert res.json_body['sub_content_types'] |
| 2553 |
|
params_active = { |
| 2554 |
|
'parent_id': 0, |
| 2555 |
|
'show_archived': 0, |
| 2556 |
|
'show_deleted': 0, |
| 2557 |
|
'show_active': 1, |
| 2558 |
|
} |
| 2559 |
|
# INFO - G.M - 2018-06-165 - Verify if new content is correctly created |
| 2560 |
|
active_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_active, status=200).json_body # nopep8 |
| 2561 |
|
assert res.json_body in active_contents |
| 2562 |
|
|
| 2563 |
|
def test_api__post_content_create_generic_content__err_400__parent_id_0(self) -> None: # nopep8 |
| 2564 |
|
""" |