diff --git a/backend/tests/test_robust_boundary_file_size.py b/backend/tests/test_robust_boundary_file_size.py new file mode 100644 index 0000000..263f31c --- /dev/null +++ b/backend/tests/test_robust_boundary_file_size.py @@ -0,0 +1,17 @@ +""" +TC_003 - Robust boundary test for file size above maximum size +""" +def test_file_size_robust_boundary(self): + # Creates a file with invalid size + invalid_above_file = SimpleUploadedFile("test_above_max.txt", b"x" * (max_size + 1)) + # Creates AthleteFile object with the invalid file + athlete_above_file = AthleteFile(athlete=self.user, owner=self.user, file=invalid_above_file) + + try: + # Runs a validation check + athlete_above_file.full_clean() + # Fails if no validation errors are raised + self.fail("ValidationError not raised for file above maximum size.") + except ValidationError as e: + # Passes if validation error is raised. + self.assertIn('file', e.message_dict)