test_purge_queue.py 473 B

123456789101112131415161718
  1. from types import SimpleNamespace
  2. import pytest
  3. from mock import patch, MagicMock
  4. from backend.lambdas.tasks.purge_queue import handler
  5. pytestmark = [pytest.mark.unit, pytest.mark.task]
  6. @patch("backend.lambdas.tasks.purge_queue.sqs")
  7. def test_it_purges_queue(mock_resource):
  8. mock_queue = MagicMock()
  9. mock_resource.Queue.return_value = mock_queue
  10. event = {"QueueUrl": "queue_url"}
  11. handler(event, SimpleNamespace())
  12. mock_queue.purge.assert_called()