|
1 | 1 | from aws_lambda_powertools.utilities.typing import LambdaContext
|
| 2 | +from aws_lambda_powertools.utilities.typing.lambda_client_context import LambdaClientContext |
| 3 | +from aws_lambda_powertools.utilities.typing.lambda_client_context_mobile_client import LambdaClientContextMobileClient |
| 4 | +from aws_lambda_powertools.utilities.typing.lambda_cognito_identity import LambdaCognitoIdentity |
2 | 5 |
|
3 | 6 |
|
4 | 7 | def test_typing():
|
5 | 8 | context = LambdaContext()
|
| 9 | + context._function_name = "_function_name" |
| 10 | + context._function_version = "_function_version" |
| 11 | + context._invoked_function_arn = "_invoked_function_arn" |
| 12 | + context._memory_limit_in_mb = "_memory_limit_in_mb" |
| 13 | + context._aws_request_id = "_aws_request_id" |
| 14 | + context._log_group_name = "_log_group_name" |
| 15 | + context._log_stream_name = "_log_stream_name" |
| 16 | + identity = LambdaCognitoIdentity() |
| 17 | + identity._cognito_identity_id = "_cognito_identity_id" |
| 18 | + identity._cognito_identity_pool_id = "_cognito_identity_pool_id" |
| 19 | + context._identity = identity |
| 20 | + client_context = LambdaClientContext() |
| 21 | + client = LambdaClientContextMobileClient() |
| 22 | + client._installation_id = "_installation_id" |
| 23 | + client._app_title = "_app_title" |
| 24 | + client._app_version_name = "_app_version_name" |
| 25 | + client._app_version_code = "_app_version_code" |
| 26 | + client._app_package_name = "_app_package_name" |
| 27 | + client_context._client = client |
| 28 | + client_context._custom = {} |
| 29 | + client_context._env = {} |
| 30 | + context._client_context = client_context |
| 31 | + |
| 32 | + assert context.function_name == context._function_name |
| 33 | + assert context.function_version == context._function_version |
| 34 | + assert context.invoked_function_arn == context._invoked_function_arn |
| 35 | + assert context.memory_limit_in_mb == context._memory_limit_in_mb |
| 36 | + assert context.aws_request_id == context._aws_request_id |
| 37 | + assert context.log_group_name == context._log_group_name |
| 38 | + assert context.log_stream_name == context._log_stream_name |
| 39 | + assert context.identity == context._identity |
| 40 | + assert context.identity.cognito_identity_id == identity._cognito_identity_id |
| 41 | + assert context.identity.cognito_identity_pool_id == identity._cognito_identity_pool_id |
| 42 | + assert context.client_context == context._client_context |
| 43 | + assert context.client_context.client == client_context._client |
| 44 | + assert context.client_context.client.installation_id == client._installation_id |
| 45 | + assert context.client_context.client.app_title == client._app_title |
| 46 | + assert context.client_context.client.app_version_name == client._app_version_name |
| 47 | + assert context.client_context.client.app_version_code == client._app_version_code |
| 48 | + assert context.client_context.client.app_package_name == client._app_package_name |
| 49 | + assert context.client_context.custom == client_context._custom |
| 50 | + assert context.client_context.env == client_context._env |
6 | 51 | assert context.get_remaining_time_in_millis() == 0
|
0 commit comments