tests: use https:// scheme in webtest client (#71943)

Adaptation to change in authentic settings (SESSION_COOKIE_SECURE=True).
This commit is contained in:
Benjamin Dauvergne 2022-12-01 19:08:29 +01:00
parent 347f4d2bc6
commit 666ee5e9df
2 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ def app(request, db, settings, tmpdir):
wtm._patch_settings()
request.addfinalizer(wtm._unpatch_settings)
settings.MEDIA_DIR = str(tmpdir.mkdir('media'))
return django_webtest.DjangoTestApp(extra_environ={'HTTP_HOST': 'localhost'})
return django_webtest.DjangoTestApp(extra_environ={'HTTP_HOST': 'localhost', 'wsgi.url_scheme': 'https'})
@pytest.fixture(autouse=True)

View File

@ -175,7 +175,7 @@ def test_liege_service_admin(app, base):
'csrfmiddlewaretoken': app.cookies['csrftoken'],
'action': 'add',
'role': base.role_service_liege.pk
})
}, headers={'Referer': 'https://localhost'})
assert base.user_liege.roles.count() == 1
assert base.user_liege.roles.get().name == 'Accès Service'