|
1 | 1 | """Tests for lambda_handler""" |
2 | 2 |
|
3 | 3 | import json |
4 | | -import sys |
5 | 4 | from contextlib import ExitStack |
6 | 5 | from copy import deepcopy |
7 | 6 | from json import loads as json_loads |
@@ -778,37 +777,3 @@ def test_unexpected_bucket_name_and_filename_validation_fails(self): |
778 | 777 | self.assertIn("Unable to process file", args[0]) |
779 | 778 | self.assertIn(invalid_file_key, args) |
780 | 779 | self.assertIn("unknown-bucket", args) |
781 | | - |
782 | | - |
783 | | -class TestMainEntryPoint(TestCase): |
784 | | - def test_run_local_constructs_event_and_calls_lambda_handler(self): |
785 | | - test_args = [ |
786 | | - "file_name_processor.py", |
787 | | - "--bucket", |
788 | | - "test-bucket", |
789 | | - "--key", |
790 | | - "some/path/file.csv", |
791 | | - ] |
792 | | - |
793 | | - expected_event = { |
794 | | - "Records": [ |
795 | | - { |
796 | | - "s3": { |
797 | | - "bucket": {"name": "test-bucket"}, |
798 | | - "object": {"key": "some/path/file.csv"}, |
799 | | - } |
800 | | - } |
801 | | - ] |
802 | | - } |
803 | | - |
804 | | - with ( |
805 | | - patch.object(sys, "argv", test_args), |
806 | | - patch("file_name_processor.lambda_handler") as mock_lambda_handler, |
807 | | - patch("file_name_processor.print") as mock_print, |
808 | | - ): |
809 | | - import file_name_processor |
810 | | - |
811 | | - file_name_processor.run_local() |
812 | | - |
813 | | - mock_lambda_handler.assert_called_once_with(event=expected_event, context={}) |
814 | | - mock_print.assert_called() |
0 commit comments