Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
test(apps/tasks): add test
Browse files Browse the repository at this point in the history
  • Loading branch information
HladczukLe committed Dec 10, 2023
1 parent ca94b1b commit d3051cf
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions apps/tasks/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,23 @@ def test_upload_file_form_valid(self) -> None:

self.assertTrue(form.is_valid())

def test_upload_form_valid(self) -> None:
file_content = b"Test file content"

upload_form = SimpleUploadedFile("test_file.txt", file_content)

form_data = {"title": "Test Title"}
files_data = MultiValueDict(
{"file": [cast(UploadedFile, upload_form)]}
)

form = UploadFileForm(data=form_data, files=files_data)

if not form.is_valid():
print(form.errors)

self.assertTrue(form.is_valid())


class BackgroundJobTaskTest(TestCase):
def setUp(self) -> None:
Expand Down

0 comments on commit d3051cf

Please sign in to comment.