aboutsummaryrefslogtreecommitdiff
path: root/tests/playwright/conftest.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/playwright/conftest.py')
-rw-r--r--tests/playwright/conftest.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/tests/playwright/conftest.py b/tests/playwright/conftest.py
index 21edca8..18b7ad0 100644
--- a/tests/playwright/conftest.py
+++ b/tests/playwright/conftest.py
@@ -8,7 +8,7 @@ from pyramid.authentication import AuthTktCookieHelper
from pyramid.testing import DummyRequest
from testutils import load_gpx_asset
-from fietsboek import models, util
+from fietsboek import models, util, actions
from fietsboek.models.track import Visibility, TrackType
from fietsboek.config import Config
@@ -114,20 +114,23 @@ class Helper:
user = self.john_doe()
with self.dbaccess:
user = self.dbaccess.merge(user)
- track = models.Track(
+ track = actions.add_track(
+ self.dbaccess,
+ self.data_manager,
+ owner=user,
title="Another awesome track",
visibility=Visibility.PRIVATE,
description="Another description",
- type=TrackType.ORGANIC,
- link_secret=util.random_link_secret(),
+ track_type=TrackType.ORGANIC,
+ date=datetime.datetime(2022, 12, 21, 17, 5, tzinfo=datetime.timezone.utc),
+ tags=[],
+ badges=[],
+ tagged_people=[],
+ gpx_data=load_gpx_asset(track_name),
)
- track.date = datetime.datetime(2022, 12, 21, 17, 5, tzinfo=datetime.timezone.utc)
- user.tracks.append(track)
- self.dbaccess.flush()
- self.dbaccess.refresh(track, ["id"])
- self.dbaccess.expunge(track)
- self.data_manager.initialize(track.id).compress_gpx(load_gpx_asset(track_name))
self.dbaccess.commit()
+ self.dbaccess.refresh(track, ["id", "link_secret"])
+ self.dbaccess.expunge(track)
return track