In case of general error, failed service use should be incremented by searches length

This commit is contained in:
Juan Ignacio Sánchez Lara
2018-07-19 21:19:00 +02:00
parent fd097724f1
commit cd5e6510a6
2 changed files with 9 additions and 2 deletions

View File

@@ -8,11 +8,13 @@ from cartodb_services.geocoder import run_street_point_geocoder
class TestRunStreetPointGeocoder(TestCase):
def test_count_increment_total_service_use_on_error(self):
def test_count_increment_total_and_failed_service_use_on_error(self):
quota_service_mock = Mock()
service_manager_mock = Mock()
service_manager_mock.quota_service = quota_service_mock
service_manager_mock.assert_within_limits = \
Mock(side_effect=Exception('Fail!'))
searches = []
@@ -27,3 +29,6 @@ class TestRunStreetPointGeocoder(TestCase):
quota_service_mock.increment_total_service_use. \
assert_called_once_with(len(searches))
quota_service_mock.increment_failed_service_use. \
assert_called_once_with(len(searches))