diff --git a/apps/workspaces/apis/clone_settings/views.py b/apps/workspaces/apis/clone_settings/views.py index 512bfd2a..93094c50 100644 --- a/apps/workspaces/apis/clone_settings/views.py +++ b/apps/workspaces/apis/clone_settings/views.py @@ -16,6 +16,17 @@ def get_object(self): return Workspace.objects.filter(id=latest_workspace.id).first() + def put(self, request, **kwargs): + workspace_instance = Workspace.objects.get(id=kwargs['workspace_id']) + serializer = CloneSettingsSerializer(workspace_instance, data=request.data, partial=True) + + if serializer.is_valid(raise_exception=True): + serializer.save() + return Response( + data=serializer.data, + status=status.HTTP_200_OK + ) + class CloneSettingsExistsView(generics.RetrieveAPIView): diff --git a/tests/test_workspaces/test_apis/test_clone_settings/test_views.py b/tests/test_workspaces/test_apis/test_clone_settings/test_views.py index 9ed2e057..fe236ba8 100644 --- a/tests/test_workspaces/test_apis/test_clone_settings/test_views.py +++ b/tests/test_workspaces/test_apis/test_clone_settings/test_views.py @@ -13,7 +13,7 @@ def assert_4xx_cases(api_client, url, data): assert response.status_code == 400 - assert 'This field is required.' in str(response.data), 'clone settings api returns a diff in the message' + assert 'Settings are required' in str(response.data), 'clone settings api returns a diff in the message' def test_clone_settings(api_client, test_connection):