manager: test user free search for local and e164 phones (#69907)
gitea/authentic/pipeline/head Something is wrong with the build of this commit
Details
gitea/authentic/pipeline/head Something is wrong with the build of this commit
Details
This commit is contained in:
parent
3e53e2ecf8
commit
5fd1c9d2f4
|
@ -306,6 +306,40 @@ def test_search_by_attribute(app, simple_user, admin):
|
|||
assert visible_users(response) == set()
|
||||
|
||||
|
||||
def test_search_by_phone_local_number(app, simple_user, admin, settings):
|
||||
settings.DEFAULT_COUNTRY_CODE = '33'
|
||||
Attribute.objects.create(
|
||||
kind='phone_number', name='phone', label='Phone', required=False, searchable=True
|
||||
)
|
||||
|
||||
simple_user.attributes.phone = '+33612345678'
|
||||
simple_user.save()
|
||||
|
||||
response = login(app, admin, '/manage/users/')
|
||||
|
||||
# all users are visible
|
||||
assert visible_users(response) == {simple_user.username, admin.username}
|
||||
|
||||
response.form['search-text'] = '9876543210'
|
||||
response = response.form.submit()
|
||||
# now all users are hidden
|
||||
assert not visible_users(response) & {simple_user.username, admin.username}
|
||||
|
||||
response.form['search-text'] = '0612345678'
|
||||
response = response.form.submit()
|
||||
# now we see only simple_user
|
||||
assert visible_users(response) == {simple_user.username}
|
||||
|
||||
response.form['search-text'] = '+33612345678'
|
||||
response = response.form.submit()
|
||||
assert visible_users(response) == {simple_user.username}
|
||||
|
||||
simple_user.delete()
|
||||
response.form['search-text'] = '0612345678'
|
||||
response = response.form.submit()
|
||||
assert visible_users(response) == set()
|
||||
|
||||
|
||||
def test_export_csv(settings, app, superuser, django_assert_num_queries):
|
||||
AT_COUNT = 30
|
||||
USER_COUNT = 2000
|
||||
|
|
Loading…
Reference in New Issue