|
@@ -814,6 +814,50 @@ class TestWorkspaceContents(FunctionalTest):
|
814
|
814
|
assert not [content for content in new_folder1_contents if content['id'] == 8] # nopep8
|
815
|
815
|
assert [content for content in new_folder2_contents if content['id'] == 8] # nopep8
|
816
|
816
|
|
|
817
|
+ def test_api_put_move_content__ok_200__to_root(self):
|
|
818
|
+ """
|
|
819
|
+ Move content
|
|
820
|
+ move Apple_Pie (content_id: 8)
|
|
821
|
+ from Desserts folder(content_id: 3) to root (content_id: 0)
|
|
822
|
+ of workspace Recipes.
|
|
823
|
+ """
|
|
824
|
+ self.testapp.authorization = (
|
|
825
|
+ 'Basic',
|
|
826
|
+ (
|
|
827
|
+ 'admin@admin.admin',
|
|
828
|
+ 'admin@admin.admin'
|
|
829
|
+ )
|
|
830
|
+ )
|
|
831
|
+ params = {
|
|
832
|
+ 'new_parent_id': '0', # root
|
|
833
|
+ }
|
|
834
|
+ params_folder1 = {
|
|
835
|
+ 'parent_id': 3,
|
|
836
|
+ 'show_archived': 0,
|
|
837
|
+ 'show_deleted': 0,
|
|
838
|
+ 'show_active': 1,
|
|
839
|
+ }
|
|
840
|
+ params_folder2 = {
|
|
841
|
+ 'parent_id': 0,
|
|
842
|
+ 'show_archived': 0,
|
|
843
|
+ 'show_deleted': 0,
|
|
844
|
+ 'show_active': 1,
|
|
845
|
+ }
|
|
846
|
+ folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
|
847
|
+ folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8
|
|
848
|
+ assert [content for content in folder1_contents if content['id'] == 8] # nopep8
|
|
849
|
+ assert not [content for content in folder2_contents if content['id'] == 8] # nopep8
|
|
850
|
+ # TODO - G.M - 2018-06-163 - Check content
|
|
851
|
+ res = self.testapp.put_json(
|
|
852
|
+ '/api/v2/workspaces/2/contents/8/move',
|
|
853
|
+ params=params,
|
|
854
|
+ status=200
|
|
855
|
+ )
|
|
856
|
+ new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
|
857
|
+ new_folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8
|
|
858
|
+ assert not [content for content in new_folder1_contents if content['id'] == 8] # nopep8
|
|
859
|
+ assert [content for content in new_folder2_contents if content['id'] == 8] # nopep8
|
|
860
|
+
|
817
|
861
|
def test_api_put_move_content__ok_200__with_workspace_id(self):
|
818
|
862
|
"""
|
819
|
863
|
Move content
|
|
@@ -903,6 +947,51 @@ class TestWorkspaceContents(FunctionalTest):
|
903
|
947
|
assert not [content for content in new_folder1_contents if content['id'] == 8] # nopep8
|
904
|
948
|
assert [content for content in new_folder2_contents if content['id'] == 8] # nopep8
|
905
|
949
|
|
|
950
|
+ def test_api_put_move_content__ok_200__to_another_workspace_root(self):
|
|
951
|
+ """
|
|
952
|
+ Move content
|
|
953
|
+ move Apple_Pie (content_id: 8)
|
|
954
|
+ from Desserts folder(content_id: 3) to root (content_id: 0)
|
|
955
|
+ of workspace Business.
|
|
956
|
+ """
|
|
957
|
+ self.testapp.authorization = (
|
|
958
|
+ 'Basic',
|
|
959
|
+ (
|
|
960
|
+ 'admin@admin.admin',
|
|
961
|
+ 'admin@admin.admin'
|
|
962
|
+ )
|
|
963
|
+ )
|
|
964
|
+ params = {
|
|
965
|
+ 'new_parent_id': '0', # root
|
|
966
|
+ 'new_workspace_id': '1',
|
|
967
|
+ }
|
|
968
|
+ params_folder1 = {
|
|
969
|
+ 'parent_id': 3,
|
|
970
|
+ 'show_archived': 0,
|
|
971
|
+ 'show_deleted': 0,
|
|
972
|
+ 'show_active': 1,
|
|
973
|
+ }
|
|
974
|
+ params_folder2 = {
|
|
975
|
+ 'parent_id': 0,
|
|
976
|
+ 'show_archived': 0,
|
|
977
|
+ 'show_deleted': 0,
|
|
978
|
+ 'show_active': 1,
|
|
979
|
+ }
|
|
980
|
+ folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
|
981
|
+ folder2_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_folder2, status=200).json_body # nopep8
|
|
982
|
+ assert [content for content in folder1_contents if content['id'] == 8] # nopep8
|
|
983
|
+ assert not [content for content in folder2_contents if content['id'] == 8] # nopep8
|
|
984
|
+ # TODO - G.M - 2018-06-163 - Check content
|
|
985
|
+ res = self.testapp.put_json(
|
|
986
|
+ '/api/v2/workspaces/2/contents/8/move',
|
|
987
|
+ params=params,
|
|
988
|
+ status=200
|
|
989
|
+ )
|
|
990
|
+ new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
|
991
|
+ new_folder2_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_folder2, status=200).json_body # nopep8
|
|
992
|
+ assert not [content for content in new_folder1_contents if content['id'] == 8] # nopep8
|
|
993
|
+ assert [content for content in new_folder2_contents if content['id'] == 8] # nopep8
|
|
994
|
+
|
906
|
995
|
def test_api_put_move_content__err_400__wrong_workspace_id(self):
|
907
|
996
|
"""
|
908
|
997
|
Move content
|