56 lines
1.3 KiB
Python
56 lines
1.3 KiB
Python
import pytest
|
|
from django.contrib.auth import get_user_model
|
|
from django.utils import timezone
|
|
from scrobbles.models import Scrobble
|
|
from workouts.models import Exercise, WorkoutLogData, WorkoutRoutine
|
|
|
|
User = get_user_model()
|
|
|
|
|
|
@pytest.fixture
|
|
def user(db):
|
|
return User.objects.create(email="lifter@example.com")
|
|
|
|
|
|
@pytest.fixture
|
|
def exercise(db):
|
|
return Exercise.objects.create(
|
|
name="Deadlift",
|
|
force="pull",
|
|
level="intermediate",
|
|
mechanic="compound",
|
|
equipment="barbell",
|
|
category="strength",
|
|
primary_muscles=["lower back"],
|
|
secondary_muscles=["glutes"],
|
|
instructions=["Step 1", "Step 2"],
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def workout_routine(db):
|
|
return WorkoutRoutine.objects.create(title="Test Routine")
|
|
|
|
|
|
@pytest.fixture
|
|
def workout_scrobble(user, workout_routine, exercise):
|
|
return Scrobble.objects.create(
|
|
user=user,
|
|
workout_routine=workout_routine,
|
|
media_type=Scrobble.MediaType.WORKOUT,
|
|
timestamp=timezone.now(),
|
|
played_to_completion=True,
|
|
log={
|
|
"workouts": [
|
|
{"exercise_id": exercise.id, "sets": 3, "reps": 10, "weight_kg": 50.0}
|
|
],
|
|
"duration_minutes": 45,
|
|
"bodyweight_kg": 80.0,
|
|
},
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def logdata():
|
|
return WorkoutLogData()
|