aboutsummaryrefslogtreecommitdiff
path: root/tests/integration
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/integration
parent262b7d43a34af8ca6097b2e1874e6eb8ffefe185 (diff)
downloadfietsboek-f431d0d82ddfd38f9a7e53042070a7e49ee67019.tar.gz
fietsboek-f431d0d82ddfd38f9a7e53042070a7e49ee67019.tar.bz2
fietsboek-f431d0d82ddfd38f9a7e53042070a7e49ee67019.zip
fix integration & playwright tests
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/test_browse.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/tests/integration/test_browse.py b/tests/integration/test_browse.py
index 493239f..603f301 100644
--- a/tests/integration/test_browse.py
+++ b/tests/integration/test_browse.py
@@ -2,14 +2,16 @@ import io
import zipfile
from contextlib import contextmanager
from datetime import datetime
+from pathlib import Path
from testutils import load_gpx_asset
from fietsboek import models
from fietsboek.models.track import Visibility
+from fietsboek.data import DataManager
@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 +35,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 +50,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 +69,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 +79,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")])
)