Quota test
This commit is contained in:
parent
5e8dbaf239
commit
5e34faefe5
@ -17,6 +17,7 @@ def geocoder_metadata(relevance, precision, match_types):
|
|||||||
'match_types': match_types
|
'match_types': match_types
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def compose_address(street, city=None, state=None, country=None):
|
def compose_address(street, city=None, state=None, country=None):
|
||||||
return ', '.join(filter(None, [street, city, state, country]))
|
return ', '.join(filter(None, [street, city, state, country]))
|
||||||
|
|
||||||
|
@ -131,6 +131,11 @@ class TestStreetFunctionsSetUp(TestCase):
|
|||||||
return IntegrationTestHelper.execute_query_raw(self.sql_api_url,
|
return IntegrationTestHelper.execute_query_raw(self.sql_api_url,
|
||||||
authenticated_query)
|
authenticated_query)
|
||||||
|
|
||||||
|
def _used_quota(self):
|
||||||
|
query = "select used_quota " \
|
||||||
|
"from cdb_dataservices_client.cdb_service_quota_info() " \
|
||||||
|
"where service = 'hires_geocoder'"
|
||||||
|
return self._run_authenticated(query)['rows'][0]['used_quota']
|
||||||
|
|
||||||
class TestStreetFunctions(TestStreetFunctionsSetUp):
|
class TestStreetFunctions(TestStreetFunctionsSetUp):
|
||||||
|
|
||||||
@ -305,6 +310,8 @@ class TestBulkStreetFunctions(TestStreetFunctionsSetUp):
|
|||||||
'Toronto, Canada"}}'.format(first_cartodb_id + i,
|
'Toronto, Canada"}}'.format(first_cartodb_id + i,
|
||||||
first_street_number + i))
|
first_street_number + i))
|
||||||
|
|
||||||
|
used_quota = self._used_quota()
|
||||||
|
|
||||||
query = "select *, st_x(the_geom), st_y(the_geom) " \
|
query = "select *, st_x(the_geom), st_y(the_geom) " \
|
||||||
"FROM cdb_dataservices_client.cdb_bulk_geocode_street_point( " \
|
"FROM cdb_dataservices_client.cdb_bulk_geocode_street_point( " \
|
||||||
"'select * from jsonb_to_recordset(''[" \
|
"'select * from jsonb_to_recordset(''[" \
|
||||||
@ -321,6 +328,8 @@ class TestBulkStreetFunctions(TestStreetFunctionsSetUp):
|
|||||||
assert_not_equal(metadata['precision'], None)
|
assert_not_equal(metadata['precision'], None)
|
||||||
assert_not_equal(metadata['match_types'], None)
|
assert_not_equal(metadata['match_types'], None)
|
||||||
|
|
||||||
|
assert_equal(self._used_quota(), used_quota + n)
|
||||||
|
|
||||||
def test_missing_components_on_private_function(self):
|
def test_missing_components_on_private_function(self):
|
||||||
query = "SELECT _cdb_bulk_geocode_street_point(" \
|
query = "SELECT _cdb_bulk_geocode_street_point(" \
|
||||||
" '[{\"id\": \"1\", \"address\": \"Amphitheatre Parkway 22\"}]' " \
|
" '[{\"id\": \"1\", \"address\": \"Amphitheatre Parkway 22\"}]' " \
|
||||||
|
Loading…
Reference in New Issue
Block a user