@@ 365-413 (lines=49) @@ | ||
362 | status=400 |
|
363 | ) |
|
364 | ||
365 | def test_api__update_folder__err_400__empty_label(self) -> None: # nopep8 |
|
366 | """ |
|
367 | Update(put) one folder content |
|
368 | """ |
|
369 | dbsession = get_tm_session(self.session_factory, transaction.manager) |
|
370 | admin = dbsession.query(models.User) \ |
|
371 | .filter(models.User.email == '[email protected]') \ |
|
372 | .one() |
|
373 | workspace_api = WorkspaceApi( |
|
374 | current_user=admin, |
|
375 | session=dbsession, |
|
376 | config=self.app_config |
|
377 | ) |
|
378 | content_api = ContentApi( |
|
379 | current_user=admin, |
|
380 | session=dbsession, |
|
381 | config=self.app_config |
|
382 | ) |
|
383 | test_workspace = workspace_api.create_workspace( |
|
384 | label='test', |
|
385 | save_now=True, |
|
386 | ) |
|
387 | folder = content_api.create( |
|
388 | label='test_folder', |
|
389 | content_type_slug=CONTENT_TYPES.Folder.slug, |
|
390 | workspace=test_workspace, |
|
391 | do_save=True, |
|
392 | do_notify=False |
|
393 | ) |
|
394 | transaction.commit() |
|
395 | self.testapp.authorization = ( |
|
396 | 'Basic', |
|
397 | ( |
|
398 | '[email protected]', |
|
399 | '[email protected]' |
|
400 | ) |
|
401 | ) |
|
402 | params = { |
|
403 | 'label': '', |
|
404 | 'raw_content': '<p> Le nouveau contenu </p>', |
|
405 | 'sub_content_types': [CONTENT_TYPES.Folder.slug] |
|
406 | } |
|
407 | self.testapp.put_json( |
|
408 | '/api/v2/workspaces/{workspace_id}/folders/{content_id}'.format( |
|
409 | workspace_id=test_workspace.workspace_id, |
|
410 | content_id=folder.content_id, |
|
411 | ), |
|
412 | params=params, |
|
413 | status=400 |
|
414 | ) |
|
415 | ||
416 | def test_api__update_folder__ok_200__nominal_case(self) -> None: |
|
@@ 739-785 (lines=47) @@ | ||
736 | assert content['content_id'] == folder.content_id |
|
737 | assert content['status'] == 'closed-deprecated' |
|
738 | ||
739 | def test_api__set_folder_status__err_400__wrong_status(self) -> None: |
|
740 | """ |
|
741 | Get one folder content |
|
742 | """ |
|
743 | self.testapp.authorization = ( |
|
744 | 'Basic', |
|
745 | ( |
|
746 | '[email protected]', |
|
747 | '[email protected]' |
|
748 | ) |
|
749 | ) |
|
750 | params = { |
|
751 | 'status': 'unexistant-status', |
|
752 | } |
|
753 | dbsession = get_tm_session(self.session_factory, transaction.manager) |
|
754 | admin = dbsession.query(models.User) \ |
|
755 | .filter(models.User.email == '[email protected]') \ |
|
756 | .one() |
|
757 | workspace_api = WorkspaceApi( |
|
758 | current_user=admin, |
|
759 | session=dbsession, |
|
760 | config=self.app_config |
|
761 | ) |
|
762 | content_api = ContentApi( |
|
763 | current_user=admin, |
|
764 | session=dbsession, |
|
765 | config=self.app_config |
|
766 | ) |
|
767 | test_workspace = workspace_api.create_workspace( |
|
768 | label='test', |
|
769 | save_now=True, |
|
770 | ) |
|
771 | folder = content_api.create( |
|
772 | label='test_folder', |
|
773 | content_type_slug=CONTENT_TYPES.Folder.slug, |
|
774 | workspace=test_workspace, |
|
775 | do_save=True, |
|
776 | do_notify=False |
|
777 | ) |
|
778 | transaction.commit() |
|
779 | self.testapp.put_json( |
|
780 | '/api/v2/workspaces/{workspace_id}/folders/{content_id}/status'.format( # nopep8 |
|
781 | workspace_id=test_workspace.workspace_id, |
|
782 | content_id=folder.content_id, |
|
783 | ), |
|
784 | params=params, |
|
785 | status=400 |
|
786 | ) |
|
787 | ||
788 |