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

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-lane committed Dec 28, 2023
1 parent 3fc50c7 commit bf3f2bc
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions app/views/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ def test_download_receipt(self) -> None:
download_receipt_request.user = self.user
download_receipt_request.queryset = {}

download_receipt_response = download_receipt(request=download_receipt_request)
download_receipt_response = download_receipt(
request=download_receipt_request)

get_receipt_response = self.client.get(path=download_receipt_response.url)
get_receipt_response = self.client.get(
path=download_receipt_response.url)

self.assertContains(response=get_receipt_response,
text="""<div class="progress">
Expand All @@ -88,13 +90,19 @@ def test_download_receipt(self) -> None:
parsed_url = urlparse(url=location)
query = parse_qs(qs=parsed_url.query)
task_id = query["job"]
poll_state_request = self.request_factory.post(path="", data={"task_id": task_id})
poll_state_request = self.request_factory.post(
path="", data={"task_id": task_id})
poll_state_request.user = self.user

poll_state_response = poll_state(request=poll_state_request)
self.assertContains(response=poll_state_response, text="SUCCESS", status_code=200, html=True)

download_file_request = self.request_factory.get(path="", data={"task_id": task_id})
self.assertContains(
response=poll_state_response,
text="SUCCESS",
status_code=200,
html=True)

download_file_request = self.request_factory.get(
path="", data={"task_id": task_id})
download_file_request.user = self.user

download_file_response = download_file(request=download_file_request)
Expand All @@ -105,7 +113,8 @@ def test_download_receipt(self) -> None:
"Is Celery running with a results backend enabled?"))

def test_poll_state(self) -> None:
request = self.request_factory.post(path="", data={"task_id": "test-task-id"})
request = self.request_factory.post(
path="", data={"task_id": "test-task-id"})
request.user = self.user

response = poll_state(request=request)
Expand All @@ -114,5 +123,8 @@ def test_poll_state(self) -> None:
self.assertEqual(first=response.status_code, second=200)
self.assertJSONEqual(
raw=response.content,
expected_data={"state": "PENDING", "process_percent": 0, "status": 200},
expected_data={
"state": "PENDING",
"process_percent": 0,
"status": 200},
)

0 comments on commit bf3f2bc

Please sign in to comment.