Projet

Général

Profil

0001-settings-decrease-A2_DUPLICATES_THRESHOLD-to-0.2-504.patch

Benjamin Dauvergne, 22 janvier 2021 15:40

Télécharger (1,76 ko)

Voir les différences:

Subject: [PATCH] settings: decrease A2_DUPLICATES_THRESHOLD to 0.2 (#50445)

 src/authentic2/app_settings.py | 2 +-
 tests/test_api.py              | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
src/authentic2/app_settings.py
346 346
        default=True,
347 347
        definition='If an active token exists, warn user before generating a new one.'),
348 348
    A2_DUPLICATES_THRESHOLD=Setting(
349
        default=0.7,
349
        default=0.2,
350 350
        definition='Trigram similarity threshold for considering user as duplicate.'),
351 351
    A2_DUPLICATES_BIRTHDATE_BONUS=Setting(
352 352
        default=0.3,
tests/test_api.py
1854 1854
    }
1855 1855
    user = User.objects.create(first_name='Éléonore', last_name='âêîôû')
1856 1856
    resp = app.get('/api/users/find_duplicates/', params=other_person)
1857
    assert len(resp.json['data']) == 0
1857
    assert all(match['duplicate_distance'] < 0.7 for match in resp.json['data'])
1858 1858

  
1859 1859
    other_person = {
1860 1860
        'first_name': 'Pierre',
1861 1861
        'last_name': 'Du Château',
1862 1862
    }
1863 1863
    resp = app.get('/api/users/find_duplicates/', params=other_person)
1864
    assert len(resp.json['data']) == 0
1864
    assert all(match['duplicate_distance'] < 0.7 for match in resp.json['data'])
1865 1865

  
1866 1866

  
1867 1867
def test_find_duplicates_unaccent(app, admin, settings):
1868
-