forked from aws/aws-lambda-python-runtime-interface-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_main.py
More file actions
33 lines (23 loc) · 905 Bytes
/
test_main.py
File metadata and controls
33 lines (23 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""
import os
import unittest
from unittest.mock import patch
import awslambdaric.__main__ as package_entry
class TestEnvVars(unittest.TestCase):
def setUp(self):
self.org_os_environ = os.environ
def tearDown(self):
os.environ = self.org_os_environ
@patch("awslambdaric.__main__.bootstrap")
def test_main(self, mock_bootstrap):
expected_app_root = os.getcwd()
expected_handler = "app.my_test_handler"
expected_lambda_runtime_api_addr = "test_addr"
args = ["dummy", expected_handler, "other_dummy"]
os.environ["AWS_LAMBDA_RUNTIME_API"] = expected_lambda_runtime_api_addr
package_entry.main(args)
mock_bootstrap.run.assert_called_once_with(
expected_app_root, expected_handler, expected_lambda_runtime_api_addr
)