Skip to content

Commit

Permalink
Create test_robust_boundary_file_size.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 f9883e3 commit ce0fa19
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions backend/tests/test_robust_boundary_file_size.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit ce0fa19

Please sign in to comment.