diff options
author | Daniel Schadt <kingdread@gmx.de> | 2022-07-17 21:01:41 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2022-07-17 21:01:41 +0200 |
commit | 333a06478b40d2e1b0f2243745807c745005233a (patch) | |
tree | 85de8e610c32876b7e7cff487506526ead2a7992 /tests/conftest.py | |
parent | a07ca7c0b7e567f2647d13f84db6aed201cde56c (diff) | |
parent | 69c9167911a8449fef20951abe924a1c4528545c (diff) | |
download | fietsboek-333a06478b40d2e1b0f2243745807c745005233a.tar.gz fietsboek-333a06478b40d2e1b0f2243745807c745005233a.tar.bz2 fietsboek-333a06478b40d2e1b0f2243745807c745005233a.zip |
Merge branch 'multi-download'
Diffstat (limited to 'tests/conftest.py')
-rw-r--r-- | tests/conftest.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index b8e3090..79f0245 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -141,3 +141,25 @@ def route_path(app_request): def get_route_path(*args, **kwargs): return app_request.route_path(*args, **kwargs) return get_route_path + + +@pytest.fixture() +def logged_in(dbsession, testapp, route_path): + """ + A fixture that represents a logged in state. + + This automatically creates a user and returns the created user. + + Returns the user that was logged in. + """ + user = models.User(email='foo@bar.com', is_verified=True) + user.set_password("foobar") + dbsession.add(user) + + login = testapp.get(route_path('login')) + form = login.form + form['email'] = 'foo@bar.com' + form['password'] = 'foobar' + response = form.submit() + assert response.status_code == 302 + return user |