aboutsummaryrefslogtreecommitdiff
path: root/tests/integration
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/integration
parentd5830f4000bf8f96d821fd3e93f04898af03132e (diff)
parent0e0a7e4326a592a6b99ad590e3397e6ddaeaf93a (diff)
downloadfietsboek-7a60619d3f6fd523d42f50753436f3b7e7d72ca4.tar.gz
fietsboek-7a60619d3f6fd523d42f50753436f3b7e7d72ca4.tar.bz2
fietsboek-7a60619d3f6fd523d42f50753436f3b7e7d72ca4.zip
Merge branch 'gpx-exodus'
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/test_browse.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/integration/test_browse.py b/tests/integration/test_browse.py
index 493239f..89d6f94 100644
--- a/tests/integration/test_browse.py
+++ b/tests/integration/test_browse.py
@@ -9,7 +9,7 @@ from fietsboek.models.track import Visibility
@contextmanager
-def added_tracks(tm, dbsession, owner):
+def added_tracks(tm, dbsession, owner, data_manager):
"""Adds some tracks to the database session.
This function should be used as a context manager and it ensures that the
@@ -33,8 +33,9 @@ def added_tracks(tm, dbsession, owner):
tagged_people=[],
)
track.date = datetime(2022, 3, 14, 9, 26, 54)
- track.gpx_data = load_gpx_asset("MyTourbook_1.gpx.gz")
dbsession.add(track)
+ dbsession.flush()
+ data_manager.initialize(track.id).compress_gpx(load_gpx_asset("MyTourbook_1.gpx.gz"))
tracks.append(track)
track = models.Track(
@@ -47,8 +48,9 @@ def added_tracks(tm, dbsession, owner):
tagged_people=[],
)
track.date = datetime(2022, 10, 29, 13, 37, 11)
- track.gpx_data = load_gpx_asset("Teasi_1.gpx.gz")
dbsession.add(track)
+ dbsession.flush()
+ data_manager.initialize(track.id).compress_gpx(load_gpx_asset("Teasi_1.gpx.gz"))
tracks.append(track)
tm.begin()
@@ -65,9 +67,9 @@ def added_tracks(tm, dbsession, owner):
tm.doom()
-def test_browse(testapp, dbsession, route_path, logged_in, tm):
+def test_browse(testapp, dbsession, route_path, logged_in, tm, data_manager):
# Ensure there are some tracks in the database
- with added_tracks(tm, dbsession, logged_in):
+ with added_tracks(tm, dbsession, logged_in, data_manager):
# Now go to the browse page
browse = testapp.get(route_path('browse'))
@@ -75,8 +77,8 @@ def test_browse(testapp, dbsession, route_path, logged_in, tm):
assert "Barfoo" in browse.text
-def test_archive(testapp, dbsession, route_path, logged_in, tm):
- with added_tracks(tm, dbsession, logged_in):
+def test_archive(testapp, dbsession, route_path, logged_in, tm, data_manager):
+ with added_tracks(tm, dbsession, logged_in, data_manager):
archive = testapp.get(
route_path('track-archive', _query=[("track_id[]", "1"), ("track_id[]", "2")])
)