Skip to content

Commit

Permalink
API - fix workout like response
Browse files Browse the repository at this point in the history
  • Loading branch information
SamR1 committed Nov 13, 2024
1 parent 91abd04 commit 545c555
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions fittrackee/tests/workouts/test_workouts_likes_api_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from fittrackee.workouts.models import Sport, Workout, WorkoutLike

from ..mixins import ApiTestCaseMixin, BaseTestMixin
from ..utils import OAUTH_SCOPES
from ..utils import OAUTH_SCOPES, jsonify_dict


class TestWorkoutLikePost(ApiTestCaseMixin, BaseTestMixin):
Expand Down Expand Up @@ -146,11 +146,11 @@ def test_it_creates_workout_like(
assert response.status_code == 200
data = json.loads(response.data.decode())
assert 'success' in data['status']
assert len(data['data']['workouts']) == 1
assert (
data['data']['workouts'][0]['id']
== workout_cycling_user_2.short_id
)
assert data['data']['workouts'] == [
jsonify_dict(
workout_cycling_user_2.serialize(user=user_1, light=False)
)
]
assert (
WorkoutLike.query.filter_by(
user_id=user_1.id, workout_id=workout_cycling_user_2.id
Expand Down Expand Up @@ -371,11 +371,11 @@ def test_it_removes_workout_like(
assert response.status_code == 200
data = json.loads(response.data.decode())
assert 'success' in data['status']
assert len(data['data']['workouts']) == 1
assert (
data['data']['workouts'][0]['id']
== workout_cycling_user_2.short_id
)
assert data['data']['workouts'] == [
jsonify_dict(
workout_cycling_user_2.serialize(user=user_1, light=False)
)
]
assert (
WorkoutLike.query.filter_by(
user_id=user_1.id, workout_id=workout_cycling_user_2.id
Expand Down
2 changes: 1 addition & 1 deletion fittrackee/workouts/workouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1667,7 +1667,7 @@ def like_workout(
db.session.rollback()
return {
'status': 'success',
'data': {'workouts': [workout.serialize(user=auth_user)]},
'data': {'workouts': [workout.serialize(user=auth_user, light=False)]},
}, 200


Expand Down

0 comments on commit 545c555

Please sign in to comment.