Skip to content

Commit

Permalink
Merge pull request #70 from golnazads/master
Browse files Browse the repository at this point in the history
fixed a typo
  • Loading branch information
golnazads committed Aug 7, 2023
2 parents c7cc0ac + 591980d commit 22f3d60
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
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions oraclesrv/views.py
Expand Up @@ -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.'

Expand Down

0 comments on commit 22f3d60

Please sign in to comment.