aboutsummaryrefslogtreecommitdiff
path: root/tests/playwright
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2022-12-15 23:23:14 +0100
committerDaniel Schadt <kingdread@gmx.de>2022-12-15 23:23:14 +0100
commitf431d0d82ddfd38f9a7e53042070a7e49ee67019 (patch)
tree464bd1670fea37c58c376b5337ceb41f9c39cb2e /tests/playwright
parent262b7d43a34af8ca6097b2e1874e6eb8ffefe185 (diff)
downloadfietsboek-f431d0d82ddfd38f9a7e53042070a7e49ee67019.tar.gz
fietsboek-f431d0d82ddfd38f9a7e53042070a7e49ee67019.tar.bz2
fietsboek-f431d0d82ddfd38f9a7e53042070a7e49ee67019.zip
fix integration & playwright tests
Diffstat (limited to 'tests/playwright')
-rw-r--r--tests/playwright/test_basic.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/playwright/test_basic.py b/tests/playwright/test_basic.py
index b3e340d..f2031d2 100644
--- a/tests/playwright/test_basic.py
+++ b/tests/playwright/test_basic.py
@@ -18,15 +18,13 @@ def john_doe(dbaccess):
This fixture either returns the existing John or creates a new one.
"""
- query = models.User.query_by_email("john@doe.com")
- result = dbaccess.execute(query).scalar_one_or_none()
- if result:
- return result
with dbaccess:
user = models.User(name="John Doe", email="john@doe.com", is_verified=True)
user.set_password("password")
dbaccess.add(user)
dbaccess.commit()
+ dbaccess.refresh(user, ["id"])
+ dbaccess.expunge(user)
return user
@@ -113,19 +111,20 @@ def test_upload(page: Page, john_doe, app_settings, tmp_path, dbaccess):
assert track.description == "Beschreibung der tollen Tour"
-def test_edit(page: Page, john_doe, app_settings, dbaccess):
+def test_edit(page: Page, john_doe, app_settings, dbaccess, data_manager):
do_login(app_settings, page, john_doe)
with dbaccess:
+ john_doe = dbaccess.merge(john_doe)
track = models.Track(
title="Another awesome track",
visibility=Visibility.PRIVATE,
description="Another description",
)
track.date = datetime.datetime.now(datetime.timezone.utc)
- track.gpx_data = load_gpx_asset("Teasi_1.gpx.gz")
john_doe.tracks.append(track)
dbaccess.flush()
track_id = track.id
+ data_manager.initialize(track_id).compress_gpx(load_gpx_asset("Teasi_1.gpx.gz"))
dbaccess.commit()
page.goto(f"/track/{track_id}")
@@ -152,9 +151,10 @@ def test_edit(page: Page, john_doe, app_settings, dbaccess):
assert track.description == "Not so descriptive anymore"
-def test_browse(page: Page, john_doe, app_settings, dbaccess):
+def test_browse(page: Page, john_doe, app_settings, dbaccess, data_manager):
do_login(app_settings, page, john_doe)
with dbaccess:
+ john_doe = dbaccess.merge(john_doe)
track = models.Track(
title="We're looking for this track",
visibility=Visibility.PRIVATE,
@@ -162,8 +162,9 @@ def test_browse(page: Page, john_doe, app_settings, dbaccess):
type=TrackType.ORGANIC,
)
track.date = datetime.datetime.now(datetime.timezone.utc)
- track.gpx_data = load_gpx_asset("Teasi_1.gpx.gz")
john_doe.tracks.append(track)
+ dbaccess.flush()
+ data_manager.initialize(track.id).compress_gpx(load_gpx_asset("Teasi_1.gpx.gz"))
dbaccess.commit()
page.goto("/")