Change metrics increment naming to reflect service instead of geocoder
This commit is contained in:
@@ -18,28 +18,22 @@ class QuotaService:
|
||||
def check_user_quota(self):
|
||||
return self._quota_checker.check()
|
||||
|
||||
# TODO
|
||||
# We are going to change this class to be the generic one and
|
||||
# create specific for routing and geocoding services but because
|
||||
# this implies change all the extension functions, we are going to
|
||||
# make the change in a minor release
|
||||
|
||||
def increment_success_geocoder_use(self, amount=1):
|
||||
def increment_success_service_use(self, amount=1):
|
||||
self._user_service.increment_service_use(
|
||||
self._user_service_config.service_type, "success_responses",
|
||||
amount=amount)
|
||||
|
||||
def increment_empty_geocoder_use(self, amount=1):
|
||||
def increment_empty_service_use(self, amount=1):
|
||||
self._user_service.increment_service_use(
|
||||
self._user_service_config.service_type, "empty_responses",
|
||||
amount=amount)
|
||||
|
||||
def increment_failed_geocoder_use(self, amount=1):
|
||||
def increment_failed_service_use(self, amount=1):
|
||||
self._user_service.increment_service_use(
|
||||
self._user_service_config.service_type, "fail_responses",
|
||||
amount=amount)
|
||||
|
||||
def increment_total_geocoder_use(self, amount=1):
|
||||
def increment_total_service_use(self, amount=1):
|
||||
self._user_service.increment_service_use(
|
||||
self._user_service_config.service_type, "total_requests",
|
||||
amount=amount)
|
||||
|
||||
@@ -10,7 +10,7 @@ from setuptools import setup, find_packages
|
||||
setup(
|
||||
name='cartodb_services',
|
||||
|
||||
version='0.3.1',
|
||||
version='0.3.2',
|
||||
|
||||
description='CartoDB Services API Python Library',
|
||||
|
||||
|
||||
@@ -63,18 +63,18 @@ class TestQuotaService(TestCase):
|
||||
|
||||
def test_should_check_user_increment_and_quota_check_correctly(self):
|
||||
qs = self.__build_quota_service('test_user', quota=2)
|
||||
qs.increment_success_geocoder_use()
|
||||
qs.increment_success_service_use()
|
||||
assert qs.check_user_quota() is True
|
||||
qs.increment_success_geocoder_use(amount=2)
|
||||
qs.increment_success_service_use(amount=2)
|
||||
assert qs.check_user_quota() is False
|
||||
month = date.today().strftime('%Y%m')
|
||||
|
||||
def test_should_check_org_increment_and_quota_check_correctly(self):
|
||||
qs = self.__build_quota_service('test_user', orgname='test_org',
|
||||
quota=2)
|
||||
qs.increment_success_geocoder_use()
|
||||
qs.increment_success_service_use()
|
||||
assert qs.check_user_quota() is True
|
||||
qs.increment_success_geocoder_use(amount=2)
|
||||
qs.increment_success_service_use(amount=2)
|
||||
assert qs.check_user_quota() is False
|
||||
month = date.today().strftime('%Y%m')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user