aboutsummaryrefslogtreecommitdiff
path: root/tests/playwright/test_basic.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/playwright/test_basic.py')
-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("/")