forked from mathialm/secfit
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| """ | ||
| TC_002 - Boundary test for file size | ||
| """ | ||
| def test_file_size_boundary(self): | ||
| # Create file with minimum valid size (1 byte) | ||
| min_file = SimpleUploadedFile("min_file.txt", b"x" * 1) | ||
|
|
||
| # Create file with minimum valid size (2 bytes) | ||
| min_plus_file = SimpleUploadedFile("min_plus_file.txt", b"x" * 2) | ||
|
|
||
| # Create file with maximum valid size (5MB - 1 byte) | ||
| max_minus_file = SimpleUploadedFile("max_minus_file.txt", b"x" * (max_size - 1)) | ||
|
|
||
| # Create file with maximum valid size (5MB) | ||
| max_file = SimpleUploadedFile("max_file.txt", b"x" * max_size) | ||
|
|
||
| # Create AthleteFile objects with both files | ||
| athlete_min_file = AthleteFile(athlete=self.user, owner=self.user, file=min_file) | ||
| athlete_min_plus_file = AthleteFile(athlete=self.user, owner=self.user, file=min_plus_file) | ||
| athlete_max_minus_file = AthleteFile(athlete=self.user, owner=self.user, file=max_minus_file) | ||
| athlete_max_file = AthleteFile(athlete=self.user, owner=self.user, file=max_file) | ||
|
|
||
| try: | ||
| # Runs validation checks | ||
| athlete_min_file.full_clean() | ||
| athlete_min_plus_file.full_clean() | ||
| athlete_max_minus_file.full_clean() | ||
| athlete_max_file.full_clean() | ||
| except ValidationError as e: | ||
| # Fails if any validation errors are raised | ||
| self.fail(f"ValidationError raised: {e}") |