From 8a219ed06c86dd5f12176c4c85b0e4b6629ecee8 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Fri, 22 Jan 2021 15:36:00 +0100 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(-) diff --git a/src/authentic2/app_settings.py b/src/authentic2/app_settings.py index 977eea3c..e9002e1b 100644 --- a/src/authentic2/app_settings.py +++ b/src/authentic2/app_settings.py @@ -346,7 +346,7 @@ default_settings = dict( default=True, definition='If an active token exists, warn user before generating a new one.'), A2_DUPLICATES_THRESHOLD=Setting( - default=0.7, + default=0.2, definition='Trigram similarity threshold for considering user as duplicate.'), A2_DUPLICATES_BIRTHDATE_BONUS=Setting( default=0.3, diff --git a/tests/test_api.py b/tests/test_api.py index d3aa1ac0..bba81461 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -1854,14 +1854,14 @@ def test_find_duplicates(app, admin, settings): } user = User.objects.create(first_name='Éléonore', last_name='âêîôû') resp = app.get('/api/users/find_duplicates/', params=other_person) - assert len(resp.json['data']) == 0 + assert all(match['duplicate_distance'] < 0.7 for match in resp.json['data']) other_person = { 'first_name': 'Pierre', 'last_name': 'Du Château', } resp = app.get('/api/users/find_duplicates/', params=other_person) - assert len(resp.json['data']) == 0 + assert all(match['duplicate_distance'] < 0.7 for match in resp.json['data']) def test_find_duplicates_unaccent(app, admin, settings): -- 2.29.2