diff --git a/tests/conftest.py b/tests/conftest.py index 93b62aee..633273f8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -119,6 +119,8 @@ def _app_factory(config=None): ACCOUNTS_SETTINGS_TEMPLATE="invenio_accounts/settings/base.html", ACCOUNTS_COVER_TEMPLATE="invenio_accounts/base_cover.html", WEBPACKEXT_MANIFEST_LOADER=MockManifestLoader, + SESSION_COOKIE_SECURE=True, + SESSION_COOKIE_DOMAIN="example.com", ) app.config.update(config or {}) @@ -213,6 +215,7 @@ def api(request): ), SERVER_NAME="localhost", TESTING=True, + SESSION_COOKIE_DOMAIN="localhost", ) ) @@ -277,20 +280,6 @@ def task_app(request): return app -@pytest.fixture -def cookie_app(request): - """Flask application enabled.""" - app = _app_factory( - dict( - SESSION_COOKIE_SECURE=True, - SESSION_COOKIE_DOMAIN="example.com", - ) - ) - InvenioAccounts(app) - _database_setup(app, request) - return app - - @pytest.fixture def admin_view(app): """Admin view fixture.""" diff --git a/tests/test_invenio_accounts.py b/tests/test_invenio_accounts.py index 40dcb20d..057c4313 100644 --- a/tests/test_invenio_accounts.py +++ b/tests/test_invenio_accounts.py @@ -222,11 +222,11 @@ def test_configuration(base_app): assert "deadbeef" == app.config["ACCOUNTS_USE_CELERY"] -def test_cookies(cookie_app, users): +def test_cookies(app, users): """Test cookies set on login.""" u = users[0] - with cookie_app.test_client() as client: + with app.test_client() as client: res = client.post( url_for_security("login"), data=dict(email=u["email"], password=u["password"], remember=True),