Skip to content

Commit

Permalink
Merge 2341a00 into 22f3d60
Browse files Browse the repository at this point in the history
  • Loading branch information
golnazads committed Aug 8, 2023
2 parents 22f3d60 + 2341a00 commit 11184f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions oraclesrv/tests/unittests/test_oracle_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,14 +768,14 @@ def test_cleanup_endpoint_get(self):
with mock.patch('oraclesrv.utils.clean_db', return_value=return_value):
response = cleanup()
self.assertEqual(response.status_code, 400)
self.assertEqual(json.loads(response.data), {"message": "unable to perform the cleanup, ERROR: some sqlalchemy error"})
self.assertEqual(json.loads(response.data), {"details": "unable to perform the cleanup, ERROR: some sqlalchemy error"})

# test when success
return_value = {'count_deleted_tmp': 12, 'count_updated_canonical': 3, 'count_deleted_multi_matches': 5}, ''
with mock.patch('oraclesrv.utils.clean_db', return_value=return_value):
response = cleanup()
self.assertEqual(response.status_code, 200)
self.assertEqual(json.loads(response.data), {'message': 'Successfully removed 12 matches having tmp bibcode while matches with canonical bibcode exists. '
self.assertEqual(json.loads(response.data), {'details': 'Successfully removed 12 matches having tmp bibcode while matches with canonical bibcode exists. '
'Successfully replaced 3 tmp matches with its canonical bibcode. '
'Successfully removed 5 matches having multiple matches, kept the match with highest confidence.'})

Expand All @@ -784,7 +784,7 @@ def test_cleanup_endpoint_get(self):
with mock.patch('oraclesrv.utils.clean_db', return_value=return_value):
response = cleanup()
self.assertEqual(response.status_code, 200)
self.assertEqual(json.loads(response.data), {'message': 'No duplicate (tmp and canoncial) records found. '
self.assertEqual(json.loads(response.data), {'details': 'No duplicate (tmp and canoncial) records found. '
'No tmp bibcode was updated with the canonical bibcode. '
'No multiple match records found.'})

Expand Down
4 changes: 2 additions & 2 deletions oraclesrv/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,9 @@ def cleanup():
else:
message += 'No multiple match records found.'

return return_response({'message': message}, 200)
return return_response({'details': message}, 200)
else:
return return_response({'message':'unable to perform the cleanup, ERROR: %s'%status}, 400)
return return_response({'details':'unable to perform the cleanup, ERROR: %s'%status}, 400)

@advertise(scopes=['ads:oracle-service'], rate_limit=[1000, 3600 * 24])
@bp.route('/list_tmps', methods=['GET'])
Expand Down

0 comments on commit 11184f1

Please sign in to comment.