diff --git a/backend/tests/TestExerciseNumber.py b/backend/tests/TestExerciseNumber.py index f173cc6..7d2d8d2 100644 --- a/backend/tests/TestExerciseNumber.py +++ b/backend/tests/TestExerciseNumber.py @@ -13,7 +13,7 @@ def setUp(self): self.user = get_user_model().objects.create_user(username="testuser", password="password") self.client.force_authenticate(self.user) - def test_create_workout_valid(self): # + def test_exercise_number_negative_number(self): response = self.client.post("/api/workouts/", { "name": "Morning Run", "date": now().isoformat(), @@ -27,7 +27,7 @@ def test_create_workout_valid(self): # assert response.status_code == 201 assert Workout.objects.count() == 1 - def test_create_workout_invalid_date(self): # + def test_exercise_number_non_number(self): # response = self.client.post("/api/workouts/", { "name": "Invalid Run", "date": "invalid_date", @@ -38,4 +38,87 @@ def test_create_workout_invalid_date(self): # }, format="json") assert response.status_code == 400 # Should return validation error - \ No newline at end of file + + def test_exercise_number_min_minus(self): # + response = self.client.post("/api/workouts/", { + "name": "Invalid Run", + "date": "invalid_date", + "notes": "Wrong format", + "visibility": "PU", # Adding required field + "owner": self.user.id, # Adding required field + "exercise_instances": [] # Adding required field + }, format="json") + + assert response.status_code == 400 # Should return validation error + + def test_exercise_number_min(self): # + response = self.client.post("/api/workouts/", { + "name": "Invalid Run", + "date": "invalid_date", + "notes": "Wrong format", + "visibility": "PU", # Adding required field + "owner": self.user.id, # Adding required field + "exercise_instances": [] # Adding required field + }, format="json") + + assert response.status_code == 400 # Should return validation error + + def test_exercise_number_min_plus(self): # + response = self.client.post("/api/workouts/", { + "name": "Invalid Run", + "date": "invalid_date", + "notes": "Wrong format", + "visibility": "PU", # Adding required field + "owner": self.user.id, # Adding required field + "exercise_instances": [] # Adding required field + }, format="json") + + assert response.status_code == 400 # Should return validation error + + def test_exercise_number_nom(self): # + response = self.client.post("/api/workouts/", { + "name": "Invalid Run", + "date": "invalid_date", + "notes": "Wrong format", + "visibility": "PU", # Adding required field + "owner": self.user.id, # Adding required field + "exercise_instances": [] # Adding required field + }, format="json") + + assert response.status_code == 400 # Should return validation error + + def test_exercise_number_max_minus(self): # + response = self.client.post("/api/workouts/", { + "name": "Invalid Run", + "date": "invalid_date", + "notes": "Wrong format", + "visibility": "PU", # Adding required field + "owner": self.user.id, # Adding required field + "exercise_instances": [] # Adding required field + }, format="json") + + assert response.status_code == 400 # Should return validation error + + def test_exercise_number_max(self): # + response = self.client.post("/api/workouts/", { + "name": "Invalid Run", + "date": "invalid_date", + "notes": "Wrong format", + "visibility": "PU", # Adding required field + "owner": self.user.id, # Adding required field + "exercise_instances": [] # Adding required field + }, format="json") + + assert response.status_code == 400 # Should return validation error + + def test_exercise_number_max_plus(self): # + response = self.client.post("/api/workouts/", { + "name": "Invalid Run", + "date": "invalid_date", + "notes": "Wrong format", + "visibility": "PU", # Adding required field + "owner": self.user.id, # Adding required field + "exercise_instances": [] # Adding required field + }, format="json") + + assert response.status_code == 400 # Should return validation error \ No newline at end of file