Skip to content

Commit

Permalink
Create test_special_value_workout.py
Browse files Browse the repository at this point in the history
  • Loading branch information
malenelu authored and GitHub Enterprise committed Apr 1, 2025
1 parent 6d83cae commit 6570ca7
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions backend/tests/test_special_value_workout.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""
TC_005 - Special value test for the limit of sets in an exercise instance
"""
def test_create_valid_workout(self):
response = self.client.post("/api/workouts/", {
"name": "Full body toning",
"date": now().isoformat(),
"notes": "Workout for women",
"visibility": "PU",
"owner": self.user.id,
"exercise_instances": []
}, format="json")

print(f"Response data: {response.data}")
print(f"Response status code: {response.status_code}")

assert response.status_code == 201
assert Workout.objects.count() == 1

def test_create_invalid_workout(self):
response = self.client.post("/api/workouts/", {
"name": "Full body toning",
"date": "today", # text instead of a date format
"notes": "Workout for women",
"visibility": "XO", # non-existent visibility
"owner": self.user.id,
"exercise_instances": []
}, format="json")

print(f"Error response data: {response.data}")
print(f"Error response status code: {response.status_code}")

assert response.status_code == 400

0 comments on commit 6570ca7

Please sign in to comment.