@@ 4136-4183 (lines=48) @@ | ||
4133 | assert res.json_body['content_id'] == 8 |
|
4134 | assert res.json_body['workspace_id'] == 1 |
|
4135 | ||
4136 | def test_api_put_move_content__ok_200__to_another_workspace_root(self): |
|
4137 | """ |
|
4138 | Move content |
|
4139 | move Apple_Pie (content_id: 8) |
|
4140 | from Desserts folder(content_id: 3) to root (content_id: 0) |
|
4141 | of workspace Business. |
|
4142 | """ |
|
4143 | self.testapp.authorization = ( |
|
4144 | 'Basic', |
|
4145 | ( |
|
4146 | '[email protected]', |
|
4147 | '[email protected]' |
|
4148 | ) |
|
4149 | ) |
|
4150 | params = { |
|
4151 | 'new_parent_id': None, # root |
|
4152 | 'new_workspace_id': '1', |
|
4153 | } |
|
4154 | params_folder1 = { |
|
4155 | 'parent_id': 3, |
|
4156 | 'show_archived': 0, |
|
4157 | 'show_deleted': 0, |
|
4158 | 'show_active': 1, |
|
4159 | } |
|
4160 | params_folder2 = { |
|
4161 | 'parent_id': 0, |
|
4162 | 'show_archived': 0, |
|
4163 | 'show_deleted': 0, |
|
4164 | 'show_active': 1, |
|
4165 | } |
|
4166 | folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8 |
|
4167 | folder2_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_folder2, status=200).json_body # nopep8 |
|
4168 | assert [content for content in folder1_contents if content['content_id'] == 8] # nopep8 |
|
4169 | assert not [content for content in folder2_contents if content['content_id'] == 8] # nopep8 |
|
4170 | # TODO - G.M - 2018-06-163 - Check content |
|
4171 | res = self.testapp.put_json( |
|
4172 | '/api/v2/workspaces/2/contents/8/move', |
|
4173 | params=params, |
|
4174 | status=200 |
|
4175 | ) |
|
4176 | new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8 |
|
4177 | new_folder2_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_folder2, status=200).json_body # nopep8 |
|
4178 | assert not [content for content in new_folder1_contents if content['content_id'] == 8] # nopep8 |
|
4179 | assert [content for content in new_folder2_contents if content['content_id'] == 8] # nopep8 |
|
4180 | assert res.json_body |
|
4181 | assert res.json_body['parent_id'] is None |
|
4182 | assert res.json_body['content_id'] == 8 |
|
4183 | assert res.json_body['workspace_id'] == 1 |
|
4184 | ||
4185 | def test_api_put_move_content__err_400__wrong_workspace_id(self): |
|
4186 | """ |
|
@@ 4087-4134 (lines=48) @@ | ||
4084 | assert res.json_body['content_id'] == 8 |
|
4085 | assert res.json_body['workspace_id'] == 2 |
|
4086 | ||
4087 | def test_api_put_move_content__ok_200__to_another_workspace(self): |
|
4088 | """ |
|
4089 | Move content |
|
4090 | move Apple_Pie (content_id: 8) |
|
4091 | from Desserts folder(content_id: 3) to Menus subfolder (content_id: 2) |
|
4092 | of workspace Business. |
|
4093 | """ |
|
4094 | self.testapp.authorization = ( |
|
4095 | 'Basic', |
|
4096 | ( |
|
4097 | '[email protected]', |
|
4098 | '[email protected]' |
|
4099 | ) |
|
4100 | ) |
|
4101 | params = { |
|
4102 | 'new_parent_id': '2', # Menus |
|
4103 | 'new_workspace_id': '1', |
|
4104 | } |
|
4105 | params_folder1 = { |
|
4106 | 'parent_id': 3, |
|
4107 | 'show_archived': 0, |
|
4108 | 'show_deleted': 0, |
|
4109 | 'show_active': 1, |
|
4110 | } |
|
4111 | params_folder2 = { |
|
4112 | 'parent_id': 2, |
|
4113 | 'show_archived': 0, |
|
4114 | 'show_deleted': 0, |
|
4115 | 'show_active': 1, |
|
4116 | } |
|
4117 | folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8 |
|
4118 | folder2_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_folder2, status=200).json_body # nopep8 |
|
4119 | assert [content for content in folder1_contents if content['content_id'] == 8] # nopep8 |
|
4120 | assert not [content for content in folder2_contents if content['content_id'] == 8] # nopep8 |
|
4121 | # TODO - G.M - 2018-06-163 - Check content |
|
4122 | res = self.testapp.put_json( |
|
4123 | '/api/v2/workspaces/2/contents/8/move', |
|
4124 | params=params, |
|
4125 | status=200 |
|
4126 | ) |
|
4127 | new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8 |
|
4128 | new_folder2_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_folder2, status=200).json_body # nopep8 |
|
4129 | assert not [content for content in new_folder1_contents if content['content_id'] == 8] # nopep8 |
|
4130 | assert [content for content in new_folder2_contents if content['content_id'] == 8] # nopep8 |
|
4131 | assert res.json_body |
|
4132 | assert res.json_body['parent_id'] == 2 |
|
4133 | assert res.json_body['content_id'] == 8 |
|
4134 | assert res.json_body['workspace_id'] == 1 |
|
4135 | ||
4136 | def test_api_put_move_content__ok_200__to_another_workspace_root(self): |
|
4137 | """ |
|
@@ 4038-4085 (lines=48) @@ | ||
4035 | assert res.json_body['content_id'] == 8 |
|
4036 | assert res.json_body['workspace_id'] == 2 |
|
4037 | ||
4038 | def test_api_put_move_content__ok_200__with_workspace_id(self): |
|
4039 | """ |
|
4040 | Move content |
|
4041 | move Apple_Pie (content_id: 8) |
|
4042 | from Desserts folder(content_id: 3) to Salads subfolder (content_id: 4) |
|
4043 | of workspace Recipes. |
|
4044 | """ |
|
4045 | self.testapp.authorization = ( |
|
4046 | 'Basic', |
|
4047 | ( |
|
4048 | '[email protected]', |
|
4049 | '[email protected]' |
|
4050 | ) |
|
4051 | ) |
|
4052 | params = { |
|
4053 | 'new_parent_id': '4', # Salads |
|
4054 | 'new_workspace_id': '2', |
|
4055 | } |
|
4056 | params_folder1 = { |
|
4057 | 'parent_id': 3, |
|
4058 | 'show_archived': 0, |
|
4059 | 'show_deleted': 0, |
|
4060 | 'show_active': 1, |
|
4061 | } |
|
4062 | params_folder2 = { |
|
4063 | 'parent_id': 4, |
|
4064 | 'show_archived': 0, |
|
4065 | 'show_deleted': 0, |
|
4066 | 'show_active': 1, |
|
4067 | } |
|
4068 | folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8 |
|
4069 | folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8 |
|
4070 | assert [content for content in folder1_contents if content['content_id'] == 8] # nopep8 |
|
4071 | assert not [content for content in folder2_contents if content['content_id'] == 8] # nopep8 |
|
4072 | # TODO - G.M - 2018-06-163 - Check content |
|
4073 | res = self.testapp.put_json( |
|
4074 | '/api/v2/workspaces/2/contents/8/move', |
|
4075 | params=params, |
|
4076 | status=200 |
|
4077 | ) |
|
4078 | new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8 |
|
4079 | new_folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8 |
|
4080 | assert not [content for content in new_folder1_contents if content['content_id'] == 8] # nopep8 |
|
4081 | assert [content for content in new_folder2_contents if content['content_id'] == 8] # nopep8 |
|
4082 | assert res.json_body |
|
4083 | assert res.json_body['parent_id'] == 4 |
|
4084 | assert res.json_body['content_id'] == 8 |
|
4085 | assert res.json_body['workspace_id'] == 2 |
|
4086 | ||
4087 | def test_api_put_move_content__ok_200__to_another_workspace(self): |
|
4088 | """ |
|
@@ 3989-4036 (lines=48) @@ | ||
3986 | assert res.json_body['content_id'] == 8 |
|
3987 | assert res.json_body['workspace_id'] == 2 |
|
3988 | ||
3989 | def test_api_put_move_content__ok_200__to_root(self): |
|
3990 | """ |
|
3991 | Move content |
|
3992 | move Apple_Pie (content_id: 8) |
|
3993 | from Desserts folder(content_id: 3) to root (content_id: 0) |
|
3994 | of workspace Recipes. |
|
3995 | """ |
|
3996 | self.testapp.authorization = ( |
|
3997 | 'Basic', |
|
3998 | ( |
|
3999 | '[email protected]', |
|
4000 | '[email protected]' |
|
4001 | ) |
|
4002 | ) |
|
4003 | params = { |
|
4004 | 'new_parent_id': None, # root |
|
4005 | 'new_workspace_id': 2, |
|
4006 | } |
|
4007 | params_folder1 = { |
|
4008 | 'parent_id': 3, |
|
4009 | 'show_archived': 0, |
|
4010 | 'show_deleted': 0, |
|
4011 | 'show_active': 1, |
|
4012 | } |
|
4013 | params_folder2 = { |
|
4014 | 'parent_id': 0, |
|
4015 | 'show_archived': 0, |
|
4016 | 'show_deleted': 0, |
|
4017 | 'show_active': 1, |
|
4018 | } |
|
4019 | folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8 |
|
4020 | folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8 |
|
4021 | assert [content for content in folder1_contents if content['content_id'] == 8] # nopep8 |
|
4022 | assert not [content for content in folder2_contents if content['content_id'] == 8] # nopep8 |
|
4023 | # TODO - G.M - 2018-06-163 - Check content |
|
4024 | res = self.testapp.put_json( |
|
4025 | '/api/v2/workspaces/2/contents/8/move', |
|
4026 | params=params, |
|
4027 | status=200 |
|
4028 | ) |
|
4029 | new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8 |
|
4030 | new_folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8 |
|
4031 | assert not [content for content in new_folder1_contents if content['content_id'] == 8] # nopep8 |
|
4032 | assert [content for content in new_folder2_contents if content['content_id'] == 8] # nopep8 |
|
4033 | assert res.json_body |
|
4034 | assert res.json_body['parent_id'] is None |
|
4035 | assert res.json_body['content_id'] == 8 |
|
4036 | assert res.json_body['workspace_id'] == 2 |
|
4037 | ||
4038 | def test_api_put_move_content__ok_200__with_workspace_id(self): |
|
4039 | """ |
|
@@ 3940-3987 (lines=48) @@ | ||
3937 | status=200, |
|
3938 | ) |
|
3939 | ||
3940 | def test_api_put_move_content__ok_200__nominal_case(self): |
|
3941 | """ |
|
3942 | Move content |
|
3943 | move Apple_Pie (content_id: 8) |
|
3944 | from Desserts folder(content_id: 3) to Salads subfolder (content_id: 4) |
|
3945 | of workspace Recipes. |
|
3946 | """ |
|
3947 | self.testapp.authorization = ( |
|
3948 | 'Basic', |
|
3949 | ( |
|
3950 | '[email protected]', |
|
3951 | '[email protected]' |
|
3952 | ) |
|
3953 | ) |
|
3954 | params = { |
|
3955 | 'new_parent_id': '4', # Salads |
|
3956 | 'new_workspace_id': '2', |
|
3957 | } |
|
3958 | params_folder1 = { |
|
3959 | 'parent_id': 3, |
|
3960 | 'show_archived': 0, |
|
3961 | 'show_deleted': 0, |
|
3962 | 'show_active': 1, |
|
3963 | } |
|
3964 | params_folder2 = { |
|
3965 | 'parent_id': 4, |
|
3966 | 'show_archived': 0, |
|
3967 | 'show_deleted': 0, |
|
3968 | 'show_active': 1, |
|
3969 | } |
|
3970 | folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8 |
|
3971 | folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8 |
|
3972 | assert [content for content in folder1_contents if content['content_id'] == 8] # nopep8 |
|
3973 | assert not [content for content in folder2_contents if content['content_id'] == 8] # nopep8 |
|
3974 | # TODO - G.M - 2018-06-163 - Check content |
|
3975 | res = self.testapp.put_json( |
|
3976 | '/api/v2/workspaces/2/contents/8/move', |
|
3977 | params=params, |
|
3978 | status=200 |
|
3979 | ) |
|
3980 | new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8 |
|
3981 | new_folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8 |
|
3982 | assert not [content for content in new_folder1_contents if content['content_id'] == 8] # nopep8 |
|
3983 | assert [content for content in new_folder2_contents if content['content_id'] == 8] # nopep8 |
|
3984 | assert res.json_body |
|
3985 | assert res.json_body['parent_id'] == 4 |
|
3986 | assert res.json_body['content_id'] == 8 |
|
3987 | assert res.json_body['workspace_id'] == 2 |
|
3988 | ||
3989 | def test_api_put_move_content__ok_200__to_root(self): |
|
3990 | """ |