API - get stopped speed threshold depending on sport

This commit is contained in:
Sam
2021-11-11 16:36:34 +01:00
parent 7682ccc6aa
commit b6f89d7182
6 changed files with 160 additions and 14 deletions

View File

@ -2,9 +2,11 @@ import datetime
from io import BytesIO
from typing import Generator
from unittest.mock import Mock, patch
from uuid import uuid4
import pytest
from PIL import Image
from werkzeug.datastructures import FileStorage
from fittrackee import db
from fittrackee.workouts.models import Sport, Workout, WorkoutSegment
@ -43,6 +45,7 @@ def sport_1_cycling_inactive() -> Sport:
@pytest.fixture()
def sport_2_running() -> Sport:
sport = Sport(label='Running')
sport.stopped_speed_threshold = 0.1
db.session.add(sport)
db.session.commit()
return sport
@ -575,3 +578,10 @@ def gpx_file_with_segments() -> str:
' </trk>'
'</gpx>'
)
@pytest.fixture()
def gpx_file_storage(gpx_file: str) -> FileStorage:
return FileStorage(
filename=f'{uuid4().hex}.gpx', stream=BytesIO(str.encode(gpx_file))
)