diff --git a/fittrackee/tests/workouts/test_workouts_likes_api_post.py b/fittrackee/tests/workouts/test_workouts_likes_api_post.py index 144c773c6..dc5449659 100644 --- a/fittrackee/tests/workouts/test_workouts_likes_api_post.py +++ b/fittrackee/tests/workouts/test_workouts_likes_api_post.py @@ -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): @@ -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 @@ -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 diff --git a/fittrackee/workouts/workouts.py b/fittrackee/workouts/workouts.py index 7061b16c4..0f48d6cc9 100644 --- a/fittrackee/workouts/workouts.py +++ b/fittrackee/workouts/workouts.py @@ -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