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): fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
HladczukLe committed Dec 10, 2023
1 parent d3051cf commit f53a78e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions apps/tasks/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ def test_handle_uploaded_file(self) -> None:
content = file.read()
self.assertEqual(content, file_content)

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

uploaded_file = SimpleUploadedFile("test_file.txt", file_content)
Expand All @@ -553,29 +553,29 @@ def test_upload_file_form_valid(self) -> None:
{"file": [cast(UploadedFile, uploaded_file)]}
)

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

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

self.assertTrue(form.is_valid())
self.assertTrue(upload_form.is_valid())

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

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

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

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

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

self.assertTrue(form.is_valid())
self.assertTrue(upload_form.is_valid())


class BackgroundJobTaskTest(TestCase):
Expand Down

0 comments on commit f53a78e

Please sign in to comment.