diff options
Diffstat (limited to 'tests/integration')
-rw-r--r-- | tests/integration/test_browse.py | 16 |
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")]) ) |