From f62167d370941a9a29a60dd67bdc2ec18b3ef472 Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Tue, 22 Dec 2020 17:44:06 +0100 Subject: [PATCH] misc: add authentic to statistics providers (#49700) --- combo/apps/dataviz/__init__.py | 2 +- debian/debian_config.py | 3 +++ tests/test_dataviz.py | 8 ++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/combo/apps/dataviz/__init__.py b/combo/apps/dataviz/__init__.py index 948f4960..6fa0b315 100644 --- a/combo/apps/dataviz/__init__.py +++ b/combo/apps/dataviz/__init__.py @@ -39,7 +39,7 @@ class AppConfig(django.apps.AppConfig): if not settings.KNOWN_SERVICES: return - statistics_providers = settings.STATISTICS_PROVIDERS + ['bijoe'] + statistics_providers = settings.STATISTICS_PROVIDERS start_update = timezone.now() for provider in statistics_providers: if isinstance(provider, dict): diff --git a/debian/debian_config.py b/debian/debian_config.py index 01a70587..76b6848c 100644 --- a/debian/debian_config.py +++ b/debian/debian_config.py @@ -15,6 +15,9 @@ INSTALLED_APPS = ('hobo.agent.combo', ) + INSTALLED_APPS # add statics_hash context processor TEMPLATES[0]['OPTIONS']['context_processors'].append('hobo.context_processors.statics_hash') +# add known statistics providers +STATISTICS_PROVIDERS.extend(['bijoe', 'authentic']) + # # local settings # diff --git a/tests/test_dataviz.py b/tests/test_dataviz.py index 66fda445..2342bc43 100644 --- a/tests/test_dataviz.py +++ b/tests/test_dataviz.py @@ -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): -- 2.20.1