misc: add authentic to statistics providers (#49700)
This commit is contained in:
parent
7c88233d7d
commit
a4546a919b
|
@ -39,9 +39,8 @@ class AppConfig(django.apps.AppConfig):
|
|||
if not settings.KNOWN_SERVICES:
|
||||
return
|
||||
|
||||
statistics_providers = settings.STATISTICS_PROVIDERS + ['bijoe']
|
||||
start_update = timezone.now()
|
||||
for provider in statistics_providers:
|
||||
for provider in settings.STATISTICS_PROVIDERS:
|
||||
if isinstance(provider, dict):
|
||||
url = provider['url']
|
||||
sites = {provider['id']: {'title': provider['name']}}
|
||||
|
|
|
@ -351,8 +351,8 @@ COMBO_MAP_LAYER_ASSET_SLOTS = {}
|
|||
# known services
|
||||
KNOWN_SERVICES = {}
|
||||
|
||||
# known services exposing statistics
|
||||
STATISTICS_PROVIDERS = []
|
||||
# services known to expose statistics
|
||||
STATISTICS_PROVIDERS = ['bijoe', 'authentic']
|
||||
|
||||
# PWA Settings
|
||||
PWA_VAPID_PUBLIK_KEY = None
|
||||
|
@ -367,7 +367,6 @@ BOOKING_CALENDAR_CELL_ENABLED = False
|
|||
LEGACY_CHART_CELL_ENABLED = False
|
||||
NEWSLETTERS_CELL_ENABLED = False
|
||||
|
||||
|
||||
def debug_show_toolbar(request):
|
||||
from debug_toolbar.middleware import show_toolbar as dt_show_toolbar
|
||||
return dt_show_toolbar(request) and not request.path.startswith('/__skeleton__/')
|
||||
|
|
|
@ -282,8 +282,6 @@ STATISTICS_LIST = {
|
|||
|
||||
@remember_called
|
||||
def new_api_mock(url, request):
|
||||
if url.path == '/visualization/json/': # nothing from bijoe
|
||||
return {'content': b'{}', 'request': request, 'status_code': 200}
|
||||
if url.path == '/api/statistics/':
|
||||
return {'content': json.dumps(STATISTICS_LIST), 'request': request, 'status_code': 200}
|
||||
if url.path == '/api/statistics/one-serie/':
|
||||
|
@ -322,6 +320,7 @@ def statistics(settings):
|
|||
"plop": {"title": "test", "url": "https://bijoe.example.com", "secret": "combo", "orig": "combo"}
|
||||
}
|
||||
}
|
||||
settings.STATISTICS_PROVIDERS = ['bijoe']
|
||||
appconfig = apps.get_app_config('dataviz')
|
||||
appconfig.hourly()
|
||||
assert Statistic.objects.count() == len(VISUALIZATION_JSON)
|
||||
|
@ -1221,6 +1220,11 @@ def test_dataviz_api_list_statistics(new_api_statistics, settings):
|
|||
assert statistic.url == 'https://stat.com/stats/1/'
|
||||
assert statistic.available
|
||||
|
||||
settings.STATISTICS_PROVIDERS.append('unknown')
|
||||
appconfig = apps.get_app_config('dataviz')
|
||||
with HTTMock(url_mock):
|
||||
appconfig.hourly() # unknown provider is ignored
|
||||
|
||||
|
||||
@with_httmock(new_api_mock)
|
||||
def test_chartng_cell_new_api_filter_params(new_api_statistics, nocache, freezer):
|
||||
|
|
|
@ -976,7 +976,7 @@ def test_index_site_num_queries(settings, app):
|
|||
assert IndexedCell.objects.count() == 50
|
||||
with CaptureQueriesContext(connection) as ctx:
|
||||
index_site()
|
||||
assert len(ctx.captured_queries) == 223
|
||||
assert len(ctx.captured_queries) == 224
|
||||
|
||||
SearchCell.objects.create(
|
||||
page=page, placeholder='content', order=0,
|
||||
|
|
Loading…
Reference in New Issue