Projet

Général

Profil

0001-misc-add-authentic-to-statistics-providers-49700.patch

Valentin Deniaud, 23 décembre 2020 11:06

Télécharger (2,82 ko)

Voir les différences:

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(-)
combo/apps/dataviz/__init__.py
39 39
        if not settings.KNOWN_SERVICES:
40 40
            return
41 41

  
42
        statistics_providers = settings.STATISTICS_PROVIDERS + ['bijoe']
42
        statistics_providers = settings.STATISTICS_PROVIDERS
43 43
        start_update = timezone.now()
44 44
        for provider in statistics_providers:
45 45
            if isinstance(provider, dict):
debian/debian_config.py
15 15
# add statics_hash context processor
16 16
TEMPLATES[0]['OPTIONS']['context_processors'].append('hobo.context_processors.statics_hash')
17 17

  
18
# add known statistics providers
19
STATISTICS_PROVIDERS.extend(['bijoe', 'authentic'])
20

  
18 21
#
19 22
# local settings
20 23
#
tests/test_dataviz.py
282 282

  
283 283
@remember_called
284 284
def new_api_mock(url, request):
285
    if url.path == '/visualization/json/':  # nothing from bijoe
286
        return {'content': b'{}', 'request': request, 'status_code': 200}
287 285
    if url.path == '/api/statistics/':
288 286
        return {'content': json.dumps(STATISTICS_LIST), 'request': request, 'status_code': 200}
289 287
    if url.path == '/api/statistics/one-serie/':
......
322 320
            "plop": {"title": "test", "url": "https://bijoe.example.com", "secret": "combo", "orig": "combo"}
323 321
        }
324 322
    }
323
    settings.STATISTICS_PROVIDERS = ['bijoe']
325 324
    appconfig = apps.get_app_config('dataviz')
326 325
    appconfig.hourly()
327 326
    assert Statistic.objects.count() == len(VISUALIZATION_JSON)
......
1221 1220
    assert statistic.url == 'https://stat.com/stats/1/'
1222 1221
    assert statistic.available
1223 1222

  
1223
    settings.STATISTICS_PROVIDERS.append('unknown')
1224
    appconfig = apps.get_app_config('dataviz')
1225
    with HTTMock(url_mock):
1226
        appconfig.hourly()  # unknown provider is ignored
1227

  
1224 1228

  
1225 1229
@with_httmock(new_api_mock)
1226 1230
def test_chartng_cell_new_api_filter_params(new_api_statistics, nocache, freezer):
1227
-