# Path: ecs_scheduler/triggers.py
# def init():
# def get(trigger_name):
#     def determine_task_count(self, job_data):
#     def __init__(self):
#     def determine_task_count(self, job_data):
#     def _calculate_task_count(self, message_count, job_data):
# class NoOpTrigger:
# class SqsTrigger:


import unittest
from unittest.mock import patch, Mock
from ecs_scheduler.triggers import (
    NoOpTrigger, SqsTrigger, get, init, _triggers
)
    def test_determine_task_count_returns_max_count_if_calculated_count_greater_than_max(self):
        test_data = {
            'taskCount': 1,
            'trigger': {'queueName': 'testQueue', 'messagesPerTask': 10},
            'maxCount': 2,
        }
        fake_queue = Mock(attributes={'ApproximateNumberOfMessages': 40})
        self._trigger._sqs.get_queue_by_name.return_value = fake_queue

        count = self._trigger.determine_task_count(test_data)

        self.assertEqual(2, count)

    def test_determine_task_count_returns_calculated_count_with_remainder_based_on_factor(self):
        test_data = {
            'taskCount': 1,
            'trigger': {'queueName': 'testQueue', 'messagesPerTask': 10},
        }
        fake_queue = Mock(attributes={'ApproximateNumberOfMessages': 41})
        self._trigger._sqs.get_queue_by_name.return_value = fake_queue

        count = self._trigger.determine_task_count(test_data)

        self.assertEqual(5, count)

    def test_determine_task_count_returns_calculated_count_if_equal_messages_to_factor(self):
        test_data = {
            'taskCount': 1,
            'trigger': {'queueName': 'testQueue', 'messagesPerTask': 10},
        }

# Path: ecs_scheduler/triggers.py
# def init():
# def get(trigger_name):
#     def determine_task_count(self, job_data):
#     def __init__(self):
#     def determine_task_count(self, job_data):
#     def _calculate_task_count(self, message_count, job_data):
# class NoOpTrigger:
# class SqsTrigger:


# Path: test/test_triggers.py
import unittest
from unittest.mock import patch, Mock
from ecs_scheduler.triggers import (
    NoOpTrigger, SqsTrigger, get, init, _triggers
)

    def test_determine_task_count_returns_max_count_if_calculated_count_greater_than_max(self):
        test_data = {
            'taskCount': 1,
            'trigger': {'queueName': 'testQueue', 'messagesPerTask': 10},
            'maxCount': 2,
        }
        fake_queue = Mock(attributes={'ApproximateNumberOfMessages': 40})
        self._trigger._sqs.get_queue_by_name.return_value = fake_queue

        count = self._trigger.determine_task_count(test_data)

        self.assertEqual(2, count)

    def test_determine_task_count_returns_calculated_count_with_remainder_based_on_factor(self):
        test_data = {
            'taskCount': 1,
            'trigger': {'queueName': 'testQueue', 'messagesPerTask': 10},
        }
        fake_queue = Mock(attributes={'ApproximateNumberOfMessages': 41})
        self._trigger._sqs.get_queue_by_name.return_value = fake_queue

        count = self._trigger.determine_task_count(test_data)

        self.assertEqual(5, count)

    def test_determine_task_count_returns_calculated_count_if_equal_messages_to_factor(self):
        test_data = {
            'taskCount': 1,
            'trigger': {'queueName': 'testQueue', 'messagesPerTask': 10},
        }

        fake_queue = Mock(attributes={'ApproximateNumberOfMessages': 10})