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.
Create test_robust_boundary_file_size.py
- Loading branch information
Showing
1 changed file
with
17 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,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) |