aboutsummaryrefslogtreecommitdiff
path: root/tests/playwright/test_basic.py
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2022-12-20 20:17:59 +0100
committerDaniel Schadt <kingdread@gmx.de>2022-12-20 20:17:59 +0100
commit7a60619d3f6fd523d42f50753436f3b7e7d72ca4 (patch)
tree5a5afe7dda6631100f2f52fac0d1935f7627026d /tests/playwright/test_basic.py
parentd5830f4000bf8f96d821fd3e93f04898af03132e (diff)
parent0e0a7e4326a592a6b99ad590e3397e6ddaeaf93a (diff)
downloadfietsboek-7a60619d3f6fd523d42f50753436f3b7e7d72ca4.tar.gz
fietsboek-7a60619d3f6fd523d42f50753436f3b7e7d72ca4.tar.bz2
fietsboek-7a60619d3f6fd523d42f50753436f3b7e7d72ca4.zip
Merge branch 'gpx-exodus'
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("/")