diff --git a/oraclesrv/tests/unittests/test_oracle_service.py b/oraclesrv/tests/unittests/test_oracle_service.py index 3790478..d52b437 100644 --- a/oraclesrv/tests/unittests/test_oracle_service.py +++ b/oraclesrv/tests/unittests/test_oracle_service.py @@ -764,14 +764,14 @@ def test_cleanup_endpoint_get(self): Test cleanup endpoint """ # test when there is an error - return_value = {'count_deleted_tmp': -1, 'count_updated_canonical': -1, 'count_deleted_duplicate': -1}, 'some sqlalchemy error' + return_value = {'count_deleted_tmp': -1, 'count_updated_canonical': -1, 'count_deleted_multi_matches': -1}, 'some sqlalchemy error' 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"}) # test when success - return_value = {'count_deleted_tmp': 12, 'count_updated_canonical': 3, 'count_deleted_duplicate': 5}, '' + 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) @@ -780,7 +780,7 @@ def test_cleanup_endpoint_get(self): 'Successfully removed 5 matches having multiple matches, kept the match with highest confidence.'}) # test when database is clean - return_value = {'count_deleted_tmp': 0, 'count_updated_canonical': 0, 'count_deleted_duplicate': 0}, '' + return_value = {'count_deleted_tmp': 0, 'count_updated_canonical': 0, 'count_deleted_multi_matches': 0}, '' with mock.patch('oraclesrv.utils.clean_db', return_value=return_value): response = cleanup() self.assertEqual(response.status_code, 200) diff --git a/oraclesrv/views.py b/oraclesrv/views.py index 80c9373..d73fc3c 100644 --- a/oraclesrv/views.py +++ b/oraclesrv/views.py @@ -374,8 +374,8 @@ def cleanup(): message += 'Successfully replaced %d tmp matches with its canonical bibcode. ' % counts['count_updated_canonical'] else: message += 'No tmp bibcode was updated with the canonical bibcode. ' - if counts.get('count_deleted_duplicate') > 0: - message += 'Successfully removed %d matches having multiple matches, kept the match with highest confidence.' % counts['count_deleted_duplicate'] + if counts.get('count_deleted_multi_matches') > 0: + message += 'Successfully removed %d matches having multiple matches, kept the match with highest confidence.' % counts['count_deleted_multi_matches'] else: message += 'No multiple match records found.'