Skip to content

Commit

Permalink
Added mocking for length in test
Browse files Browse the repository at this point in the history
  • Loading branch information
jzbahrai committed Apr 23, 2024
1 parent 55217f6 commit d8b3571
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/app/celery/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import uuid
from datetime import datetime, timedelta
from unittest import mock
from unittest.mock import Mock, call
from unittest.mock import MagicMock, Mock, call

import pytest
import requests_mock
Expand Down Expand Up @@ -891,9 +891,10 @@ def test_process_rows_sends_save_task(
mocker.patch("app.celery.tasks.create_uuid", return_value="noti_uuid")
task_mock = mocker.patch("app.celery.tasks.{}".format(expected_function))
signer_mock = mocker.patch("app.celery.tasks.signer_notification.sign")
template = Mock(id="template_id", template_type=template_type, process_type=NORMAL)
template = MagicMock(id="template_id", template_type=template_type, process_type=NORMAL)
job = Mock(id="job_id", template_version="temp_vers", notification_count=1, api_key_id=api_key_id, sender_id=sender_id)
service = Mock(id="service_id", research_mode=research_mode)
template.__len__.return_value = 1

process_rows(
[
Expand Down Expand Up @@ -1066,7 +1067,7 @@ def test_process_rows_works_without_key_type(
mocker.patch("app.celery.tasks.create_uuid", return_value="noti_uuid")
task_mock = mocker.patch("app.celery.tasks.{}".format(expected_function))
signer_mock = mocker.patch("app.celery.tasks.signer_notification.sign")
template = Mock(id="template_id", template_type=template_type, process_type=NORMAL)
template = MagicMock(id="template_id", template_type=template_type, process_type=NORMAL)
api_key = {}
job = Mock(
id="job_id",
Expand All @@ -1077,6 +1078,7 @@ def test_process_rows_works_without_key_type(
api_key=api_key,
)
service = Mock(id="service_id", research_mode=research_mode)
template.__len__.return_value = 1

process_rows(
[
Expand Down

0 comments on commit d8b3571

Please sign in to comment.