diff --git a/backend/media/users/2/file_a_Ap1XeTp.png b/backend/media/users/2/file_a_Ap1XeTp.png new file mode 100644 index 0000000..f4dbe63 --- /dev/null +++ b/backend/media/users/2/file_a_Ap1XeTp.png @@ -0,0 +1 @@ +dummy content \ No newline at end of file diff --git a/backend/media/users/2/file_a_fWCr2qB.png b/backend/media/users/2/file_a_fWCr2qB.png new file mode 100644 index 0000000..f4dbe63 --- /dev/null +++ b/backend/media/users/2/file_a_fWCr2qB.png @@ -0,0 +1 @@ +dummy content \ No newline at end of file diff --git a/backend/media/users/2/file_a_pIyi28o.png b/backend/media/users/2/file_a_pIyi28o.png new file mode 100644 index 0000000..f4dbe63 --- /dev/null +++ b/backend/media/users/2/file_a_pIyi28o.png @@ -0,0 +1 @@ +dummy content \ No newline at end of file diff --git a/backend/media/users/2/file_a_s9Ytvxg.png b/backend/media/users/2/file_a_s9Ytvxg.png new file mode 100644 index 0000000..f4dbe63 --- /dev/null +++ b/backend/media/users/2/file_a_s9Ytvxg.png @@ -0,0 +1 @@ +dummy content \ No newline at end of file diff --git a/backend/tests/test_TC001.py b/backend/tests/test_TC001.py index 850f2c7..dc2da2c 100644 --- a/backend/tests/test_TC001.py +++ b/backend/tests/test_TC001.py @@ -19,7 +19,7 @@ def setUp(self): name="Valid Exercise", description="A valid exercise", unit="reps" ) - def test_valid_workout_creation(self): + def test_inside_boundary(self): """Test creating a workout with valid exercises.""" url = reverse('workout-list') valid_workout_data = { @@ -37,12 +37,12 @@ def test_valid_workout_creation(self): } response = self.client.post(url, valid_workout_data, format='json') - #print(response.content) # For debugging purposes + print(response.content) # For debugging purposes # Assert that the workout was created successfully self.assertEqual(response.status_code, status.HTTP_201_CREATED) - def test_invalid_workout_creation_future_date(self): + def test_outside_boundary_right_hand(self): """Test creating a workout with an invalid future date.""" url = reverse('workout-list') invalid_workout_data = { @@ -60,12 +60,12 @@ def test_invalid_workout_creation_future_date(self): } response = self.client.post(url, invalid_workout_data, format='json') - #print(response.content) # For debugging purposes + print(response.content) # For debugging purposes # Assert that the workout creation fails due to invalid date - #self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) + self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) - def test_invalid_workout_creation_past_date(self): + def test_outside_boundary_left_hand(self): """Test creating a workout with an invalid future date.""" url = reverse('workout-list') invalid_workout_data = { @@ -83,10 +83,8 @@ def test_invalid_workout_creation_past_date(self): } - - response = self.client.post(url, invalid_workout_data, format='json') - #print(response.content) # For debugging purposes + print(response.content) # For debugging purposes # Assert that the workout creation fails due to invalid date - #self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) \ No newline at end of file + self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) \ No newline at end of file diff --git a/backend/tests/test_TC002.py b/backend/tests/test_TC002.py index 79b8e12..2cd6223 100644 --- a/backend/tests/test_TC002.py +++ b/backend/tests/test_TC002.py @@ -21,8 +21,7 @@ def test_athlete_initially_has_no_coach(self): self.assertIsNone(self.athlete.coach) def test_athlete_sends_request_to_coach_and_coach_accepts(self): - """Athlete sends request to a coach, and the coach accepts.""" - + """Athlete sends request to a coach, and the coach accepts.""" # Athlete sends request to coach1 response = self.client.post( "/api/offers/", @@ -52,6 +51,8 @@ def test_athlete_sends_request_to_coach_and_coach_accepts(self): self.athlete.refresh_from_db() self.assertEqual(self.athlete.coach, self.coach1) + print("Class1 has run successfully!") + def test_athlete_sends_requests_to_multiple_coaches_and_last_accepting_coach_is_assigned(self): """Athlete sends requests to multiple coaches; the last accepting coach should be assigned.""" @@ -94,6 +95,8 @@ def test_athlete_sends_requests_to_multiple_coaches_and_last_accepting_coach_is_ self.athlete.refresh_from_db() self.assertEqual(self.athlete.coach, self.coach2) + print("Class 2 has run successfully! ") + def test_multiple_requests_to_single_coach_all_other_requests_get_deleted_on_acceptance(self): """Athlete sends multiple requests to a single coach, only one gets accepted, others should be removed.""" @@ -126,4 +129,6 @@ def test_multiple_requests_to_single_coach_all_other_requests_get_deleted_on_acc # Verify that all other pending offers from athlete to coach1 were deleted remaining_offers = Offer.objects.filter(owner=self.athlete, recipient=self.coach1) - self.assertEqual(len(remaining_offers), 1) # Only one accepted offer should remain \ No newline at end of file + self.assertEqual(len(remaining_offers), 1) # Only one accepted offer should remain + + print("Class 3 has run successfully! ") \ No newline at end of file diff --git a/backend/tests/test_TC003.py b/backend/tests/test_TC003.py index 9c2baf6..7550bd7 100644 --- a/backend/tests/test_TC003.py +++ b/backend/tests/test_TC003.py @@ -19,50 +19,125 @@ def setUp(self): name="Valid Exercise", description="A valid exercise", unit="reps" ) - def test_valid_workout_creation(self): - """Test creating a workout with valid exercises.""" + def test_inside_boundary(self): url = reverse('workout-list') - valid_workout_data = { - "name": "Valid Workout", + inside_boundary_data = { + "name": "Inside Boundary", "date": "2025-04-01T10:00:00Z", "notes": "This is a valid workout", "visibility": "PU", "exercise_instances": [ { "exercise": f"/api/exercises/{self.valid_exercise.id}/", - "sets": 3, - "number": 10 + "sets": 1, + "number": 1 } ] } - response = self.client.post(url, valid_workout_data, format='json') + response = self.client.post(url, inside_boundary_data, format='json') print(response.content) # For debugging purposes # Assert that the workout was created successfully self.assertEqual(response.status_code, status.HTTP_201_CREATED) + print("/n The Workout with values-inside boundary- is created!") - def test_invalid_workout_creation(self): - """Test creating a workout with invalid exercises ie using boundary values.""" + def test_on_boundary(self): url = reverse('workout-list') - invalid_workout_data = { - "name": "Invalid Workout", + on_boundary_data = { + "name": "On Boundary Workout", "date": "2025-04-01T10:00:00Z", - "notes": "This workout has boundary values for the exercises", + "notes": "This workout has on boundary values for the exercises", "visibility": "PU", "exercise_instances": [ { "exercise": f"/api/exercises/{self.valid_exercise.id}/", - "sets": -3, # Invalid: negative sets - "number": -10 # Invalid: negative number + "sets": 0, + "number": 0 } ] } - response = self.client.post(url, invalid_workout_data, format='json') + response = self.client.post(url, on_boundary_data, format='json') print(response.content) # For debugging purposes # Assert that the workout creation fails due to invalid exercise instances self.assertEqual(response.status_code, status.HTTP_201_CREATED) #self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) - \ No newline at end of file + + print("The workout with values- on boundary- is created!") + + def test_outside_boundary(self): + url = reverse('workout-list') + outside_boundary_data = { + "name": "Outside Boundary", + "date": "2025-04-01T10:00:00Z", + "notes": "This workout has outside boundary values for the exercises", + "visibility": "PU", + "exercise_instances": [ + { + "exercise": f"/api/exercises/{self.valid_exercise.id}/", + "sets": -1, # Invalid: negative sets + "number": -1 # Invalid: negative number + } + ] + } + + response = self.client.post(url, outside_boundary_data, format='json') + print(response.content) # For debugging purposes + + # Assert that the workout creation fails due to invalid exercise instances + #self.assertEqual(response.status_code, status.HTTP_201_CREATED) + self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) + + print("The workout with values- outside boundary- is created!") + + def test_robust_outside_boundary(self): + url = reverse('workout-list') + robust_outside_boundary_data = { + "name": "Robust Outside Boundary Workout", + "date": "2025-04-01T10:00:00Z", + "notes": "This workout has outside boundary values for the exercises", + "visibility": "PU", + "exercise_instances": [ + { + "exercise": f"/api/exercises/{self.valid_exercise.id}/", + "sets": -1000, # Invalid: negative sets + "number": -10000 # Invalid: negative number + } + ] + } + + response = self.client.post(url, robust_outside_boundary_data, format='json') + print(response.content) # For debugging purposes + + # Assert that the workout creation fails due to invalid exercise instances + #self.assertEqual(response.status_code, status.HTTP_201_CREATED) + self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) + + print("The workout with values- robust outside boundary- is created!") + + def test_robust_inside_boundary(self): + url = reverse('workout-list') + robust_inside_boundary_data = { + "name": "Robust Inside Boundary Workout", + "date": "2025-04-01T10:00:00Z", + "notes": "This workout has robust inside boundary values for the exercises", + "visibility": "PU", + "exercise_instances": [ + { + "exercise": f"/api/exercises/{self.valid_exercise.id}/", + "sets": 1000, + "number": 10000 + } + ] + } + + response = self.client.post(url, robust_inside_boundary_data, format='json') + print(response.content) # For debugging purposes + + # Assert that the workout creation fails due to invalid exercise instances + self.assertEqual(response.status_code, status.HTTP_201_CREATED) + #self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) + + print("The workout with values- robust inside boundary- is created!") \ No newline at end of file