Skip to content

Commit

Permalink
cr updates
Browse files Browse the repository at this point in the history
  • Loading branch information
nsyed22 committed Dec 23, 2024
1 parent a47c6fa commit 02c8288
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions pybossa/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,14 +1049,11 @@ def project_clone(project_id=None, short_name=None):

if not (payload and payload.get('input_data_class') and payload.get('output_data_class') \
and payload.get('name') and payload.get('short_name')):
return abort(400)
return abort(400, 'Request is missing one or more of the required fields: name, short_name, input_data_class, output_data_class')

if not payload.get('password'):
payload['password'] = ""

project.input_data_class = project.info.get('data_classification', {}).get('input_data')
project.output_data_class = project.info.get('data_classification', {}).get('output_data')

try:
new_project = clone_project(project, payload)
current_app.logger.info(
Expand Down
6 changes: 3 additions & 3 deletions test/test_api/test_project_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2654,7 +2654,7 @@ def test_clone_project_edge_cases(self):


@with_context
def test_clone_project(self):
def test_clone_project_success(self):
"""Test API clone project success state"""
from pybossa.view.projects import data_access_levels

Expand All @@ -2676,7 +2676,7 @@ def test_clone_project(self):
@with_context
@patch('pybossa.api.clone_project')
def test_clone_project_error(self, clone_project):
"""Test API clone project success state"""
"""Test API clone project error when cloning project"""
from pybossa.view.projects import data_access_levels

clone_project.side_effect = Exception("Project clone error!")
Expand All @@ -2696,7 +2696,7 @@ def test_clone_project_error(self, clone_project):


@with_context
def test_clone_project_by_id(self):
def test_clone_project_by_id_success(self):
"""Test API clone project by id success state"""
from pybossa.view.projects import data_access_levels

Expand Down

0 comments on commit 02c8288

Please sign in to comment.