code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def test_binary_request(self):
"""
This tests that the service can accept and invoke a lambda when given binary data in a request
"""
input_data = self.get_binary_data(self.binary_data_file)
response = requests.post(
self.url + "/echobase64eventbody", headers={"Conten... |
This tests that the service can accept and invoke a lambda when given binary data in a request
| test_binary_request | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_default_header_content_type(self):
"""
Test that if no ContentType is given the default is "application/json"
"""
response = requests.get(self.url + "/onlysetstatuscode", timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.content.... |
Test that if no ContentType is given the default is "application/json"
| test_default_header_content_type | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_default_status_code(self):
"""
Test that if no status_code is given, the status code is 200
:return:
"""
response = requests.get(self.url + "/onlysetbody", timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), {"hello... |
Test that if no status_code is given, the status code is 200
:return:
| test_default_status_code | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_slash_after_url_path(self):
"""
Test that if no status_code is given, the status code is 200
:return:
"""
response = requests.get(self.url + "/onlysetbody/", timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), {"hel... |
Test that if no status_code is given, the status code is 200
:return:
| test_slash_after_url_path | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_default_body(self):
"""
Test that if no body is given, the response is ''
"""
response = requests.get(self.url + "/onlysetstatuscode", timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.content.decode("utf-8"), "") |
Test that if no body is given, the response is ''
| test_default_body | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_binary_request(self):
"""
This tests that the service can accept and invoke a lambda when given binary data in a request
"""
input_data = self.get_binary_data(self.binary_data_file)
response = requests.post(
self.url + "/echobase64eventbody", headers={"Conten... |
This tests that the service can accept and invoke a lambda when given binary data in a request
| test_binary_request | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_request_with_form_data(self):
"""
Form-encoded data should be put into the Event to Lambda
"""
response = requests.post(
self.url + "/echoeventbody",
headers={"Content-Type": "application/x-www-form-urlencoded"},
data="key=value",
... |
Form-encoded data should be put into the Event to Lambda
| test_request_with_form_data | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_request_with_query_params(self):
"""
Query params given should be put into the Event to Lambda
"""
response = requests.get(self.url + "/id/4", params={"key": "value"}, timeout=300)
self.assertEqual(response.status_code, 200)
response_data = response.json()
... |
Query params given should be put into the Event to Lambda
| test_request_with_query_params | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_request_with_list_of_query_params(self):
"""
Query params given should be put into the Event to Lambda
"""
response = requests.get(self.url + "/id/4", params={"key": ["value", "value2"]}, timeout=300)
self.assertEqual(response.status_code, 200)
response_data = ... |
Query params given should be put into the Event to Lambda
| test_request_with_list_of_query_params | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_request_with_path_params(self):
"""
Path Parameters given should be put into the Event to Lambda
"""
response = requests.get(self.url + "/id/4", timeout=300)
self.assertEqual(response.status_code, 200)
response_data = response.json()
self.assertEqual(r... |
Path Parameters given should be put into the Event to Lambda
| test_request_with_path_params | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_request_with_many_path_params(self):
"""
Path Parameters given should be put into the Event to Lambda
"""
response = requests.get(self.url + "/id/4/user/jacob", timeout=300)
self.assertEqual(response.status_code, 200)
response_data = response.json()
se... |
Path Parameters given should be put into the Event to Lambda
| test_request_with_many_path_params | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_forward_headers_are_added_to_event(self):
"""
Test the Forwarding Headers exist in the Api Event to Lambda
"""
response = requests.get(self.url + "/id/4", timeout=300)
response_data = response.json()
self.assertEqual(response_data.get("headers").get("X-Forwarde... |
Test the Forwarding Headers exist in the Api Event to Lambda
| test_forward_headers_are_added_to_event | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_request_with_list_of_query_params(self):
"""
Query params given should be put into the Event to Lambda
"""
response = requests.get(self.url + "/echoeventbody", params={"key": ["value", "value2"]}, timeout=300)
self.assertEqual(response.status_code, 200)
respons... |
Query params given should be put into the Event to Lambda
| test_request_with_list_of_query_params | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_cors_swagger_options_httpapi(self):
"""
This tests that the Cors headers are added to OPTIONS responses
"""
response = requests.options(
self.url + "/httpapi-echobase64eventbody", headers={"Origin": "https://abc"}, timeout=300
)
self.assert_cors(respo... |
This tests that the Cors headers are added to OPTIONS responses
| test_cors_swagger_options_httpapi | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_cors_swagger_get_httpapi(self):
"""
This tests that the Cors headers are added to _other_ method requests
"""
response = requests.get(
self.url + "/httpapi-echobase64eventbody", headers={"Origin": "https://abc"}, timeout=300
)
self.assert_cors(respons... |
This tests that the Cors headers are added to _other_ method requests
| test_cors_swagger_get_httpapi | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_cors_complex_options_presence(self):
"""
This tests that the Cors headers are added to OPTIONS responses
"""
self.assert_presence(requests.options(self.url, headers={"Origin": "https://abc"}, timeout=300), "https://abc")
self.assert_presence(
requests.options... |
This tests that the Cors headers are added to OPTIONS responses
| test_cors_complex_options_presence | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_cors_complex_post_presence(self):
"""
This tests that the Cors headers are added to POST responses
"""
self.assert_presence(requests.post(self.url, headers={"Origin": "https://abc"}, timeout=300), "https://abc")
self.assert_presence(
requests.post(self.url, h... |
This tests that the Cors headers are added to POST responses
| test_cors_complex_post_presence | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_cors_complex_absence(self):
"""
This tests that the Cors headers are NOT added to responses
when Origin is either unknown or missing
"""
self.assert_absence(requests.options(self.url, headers={"Origin": "https://unknown"}, timeout=300))
self.assert_absence(reques... |
This tests that the Cors headers are NOT added to responses
when Origin is either unknown or missing
| test_cors_complex_absence | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_cors_global(self, origin):
"""
This tests that the Cors headers are added to OPTIONS response when the global property is set
"""
response = requests.options(self.url + "/echobase64eventbody", **_create_request_params(origin))
self.assertEqual(response.status_code, 200)... |
This tests that the Cors headers are added to OPTIONS response when the global property is set
| test_cors_global | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_get_call_with_path_setup_with_any_swagger(self):
"""
Get Request to a path that was defined as ANY in SAM through Swagger
"""
response = requests.get(self.url + "/root/anyandall", timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(response... |
Get Request to a path that was defined as ANY in SAM through Swagger
| test_get_call_with_path_setup_with_any_swagger | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_post_call_with_path_setup_with_any_swagger(self):
"""
Post Request to a path that was defined as ANY in SAM through Swagger
"""
response = requests.post(self.url + "/root/anyandall", json={}, timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEq... |
Post Request to a path that was defined as ANY in SAM through Swagger
| test_post_call_with_path_setup_with_any_swagger | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_put_call_with_path_setup_with_any_swagger(self):
"""
Put Request to a path that was defined as ANY in SAM through Swagger
"""
response = requests.put(self.url + "/root/anyandall", json={}, timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual... |
Put Request to a path that was defined as ANY in SAM through Swagger
| test_put_call_with_path_setup_with_any_swagger | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_delete_call_with_path_setup_with_any_swagger(self):
"""
Delete Request to a path that was defined as ANY in SAM through Swagger
"""
response = requests.delete(self.url + "/root/anyandall", timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual... |
Delete Request to a path that was defined as ANY in SAM through Swagger
| test_delete_call_with_path_setup_with_any_swagger | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_patch_call_with_path_setup_with_any_swagger(self):
"""
Patch Request to a path that was defined as ANY in SAM through Swagger
"""
response = requests.patch(self.url + "/root/anyandall", timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(re... |
Patch Request to a path that was defined as ANY in SAM through Swagger
| test_patch_call_with_path_setup_with_any_swagger | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_binary_request(self):
"""
This tests that the service can accept and invoke a lambda when given binary data in a request
"""
input_data = self.get_binary_data(self.binary_data_file)
response = requests.post(
self.url + "/root/echobase64eventbody", headers={"C... |
This tests that the service can accept and invoke a lambda when given binary data in a request
| test_binary_request | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_get_with_cdk(self):
"""
Get Request to a path that was defined as ANY in SAM through Swagger
"""
response = requests.get(self.url + "/hello-world", timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), {"hello": "world"}) |
Get Request to a path that was defined as ANY in SAM through Swagger
| test_get_with_cdk | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_get_with_serverless(self):
"""
Get Request to a path that was defined as ANY in SAM through Swagger
"""
response = requests.get(self.url + "/hello-world", timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), {"hello": "world... |
Get Request to a path that was defined as ANY in SAM through Swagger
| test_get_with_serverless | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_cors_options(self):
"""
This tests that the Cors headers are added to option requests in the swagger template
"""
response = requests.options(
self.url + "/anypath/anypath", headers={"Origin": "https://example.com"}, timeout=300
)
self.assertEqual(re... |
This tests that the Cors headers are added to option requests in the swagger template
| test_cors_options | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_get_call_with_path_setup_with_any_implicit_api_custom_invoke_image(self):
"""
Get Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.get(self.url + "/anyandall", timeout=300)
self.assertEqual(response.status... |
Get Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_get_call_with_path_setup_with_any_implicit_api_custom_invoke_image | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_post_call_with_path_setup_with_any_implicit_api_custom_invoke_image(self):
"""
Post Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.post(self.url + "/anyandall", json={}, timeout=300)
self.assertEqual(res... |
Post Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_post_call_with_path_setup_with_any_implicit_api_custom_invoke_image | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_put_call_with_path_setup_with_any_implicit_api_custom_invoke_image(self):
"""
Put Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.put(self.url + "/anyandall", json={}, timeout=300)
self.assertEqual(respon... |
Put Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_put_call_with_path_setup_with_any_implicit_api_custom_invoke_image | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api.py | Apache-2.0 |
def test_cors_swagger_options(self):
"""
This tests that the Cors are added to option requests in the swagger template
"""
response = requests.options(self.url + "/", timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.headers.get("Access-... |
This tests that the Cors are added to option requests in the swagger template
| test_cors_swagger_options | python | aws/aws-sam-cli | tests/integration/local/start_api/test_start_api_cdk_template.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_api/test_start_api_cdk_template.py | Apache-2.0 |
def test_same_endpoint(self):
"""
Send two requests to the same path at the same time. This is to ensure we can handle
multiple requests at once and do not block/queue up requests
"""
number_of_requests = 10
start_time = time()
with ThreadPoolExecutor(number_of_re... |
Send two requests to the same path at the same time. This is to ensure we can handle
multiple requests at once and do not block/queue up requests
| test_same_endpoint | python | aws/aws-sam-cli | tests/integration/local/start_lambda/test_start_lambda.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_lambda/test_start_lambda.py | Apache-2.0 |
def test_invoke_with_function_timeout(self, use_full_path):
"""
This behavior does not match the actually Lambda Service. For functions that timeout, data returned like the
following:
{"errorMessage":"<timestamp> <request_id> Task timed out after 5.00 seconds"}
For Local Lambda'... |
This behavior does not match the actually Lambda Service. For functions that timeout, data returned like the
following:
{"errorMessage":"<timestamp> <request_id> Task timed out after 5.00 seconds"}
For Local Lambda's, however, timeouts are an interrupt on the thread that runs invokes t... | test_invoke_with_function_timeout | python | aws/aws-sam-cli | tests/integration/local/start_lambda/test_start_lambda.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_lambda/test_start_lambda.py | Apache-2.0 |
def test_invoke_with_function_timeout_using_lookup_value(self, use_full_path):
"""
This behavior does not match the actually Lambda Service. For functions that timeout, data returned like the
following:
{"errorMessage":"<timestamp> <request_id> Task timed out after 5.00 seconds"}
... |
This behavior does not match the actually Lambda Service. For functions that timeout, data returned like the
following:
{"errorMessage":"<timestamp> <request_id> Task timed out after 5.00 seconds"}
For Local Lambda's, however, timeouts are an interrupt on the thread that runs invokes t... | test_invoke_with_function_timeout_using_lookup_value | python | aws/aws-sam-cli | tests/integration/local/start_lambda/test_start_lambda.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_lambda/test_start_lambda.py | Apache-2.0 |
def tearDownClass(cls):
"""Clean up and delete the lambda layers, and bucket if it is not pre-created"""
# delete the created terraform project
if cls.should_apply_first:
apply_command = ["terraform", "destroy", "-auto-approve", "-input=false"]
stdout, _, return_code = c... | Clean up and delete the lambda layers, and bucket if it is not pre-created | tearDownClass | python | aws/aws-sam-cli | tests/integration/local/start_lambda/test_start_lambda_terraform_applications.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/start_lambda/test_start_lambda_terraform_applications.py | Apache-2.0 |
def test_package_with_deep_nested_template_image(self):
"""
this template contains two nested stacks:
- root
- FunctionA
- ChildStackX
- FunctionB
- ChildStackY
- FunctionA
"""
template_file = os.path.join("deep-nested-ima... |
this template contains two nested stacks:
- root
- FunctionA
- ChildStackX
- FunctionB
- ChildStackY
- FunctionA
| test_package_with_deep_nested_template_image | python | aws/aws-sam-cli | tests/integration/package/test_package_command_image.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/package/test_package_command_image.py | Apache-2.0 |
def test_package_with_deep_nested_template(self):
"""
this template contains two nested stacks:
- root
- FunctionA
- ChildStackX
- FunctionB
- ChildStackY
- FunctionA
- MyLayerVersion
"""
template_file = os.p... |
this template contains two nested stacks:
- root
- FunctionA
- ChildStackX
- FunctionB
- ChildStackY
- FunctionA
- MyLayerVersion
| test_package_with_deep_nested_template | python | aws/aws-sam-cli | tests/integration/package/test_package_command_zip.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/package/test_package_command_zip.py | Apache-2.0 |
def test_package_with_stackset(self):
"""
this template contains a stack set:
- root
- FunctionA
- StackSetA
"""
template_file = os.path.join("stackset", "template.yaml")
template_path = self.test_data_path.joinpath(template_file)
command_list... |
this template contains a stack set:
- root
- FunctionA
- StackSetA
| test_package_with_stackset | python | aws/aws-sam-cli | tests/integration/package/test_package_command_zip.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/package/test_package_command_zip.py | Apache-2.0 |
def test_package_with_stackset_in_a_substack(self):
"""
this template contains a stack set:
- root
- ChildStackX
- FunctionA
- StackSetA
"""
template_file = os.path.join("stackset", "nested-template.yaml")
template_path = self.test_data_... |
this template contains a stack set:
- root
- ChildStackX
- FunctionA
- StackSetA
| test_package_with_stackset_in_a_substack | python | aws/aws-sam-cli | tests/integration/package/test_package_command_zip.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/package/test_package_command_zip.py | Apache-2.0 |
def test_interactive_pipeline_user_only_created_once(self):
"""
Create 3 stages, only the first stage resource stack creates
a pipeline user, and the remaining two share the same pipeline user.
"""
stage_configuration_names = []
for suffix in ["1", "2", "3"]:
... |
Create 3 stages, only the first stage resource stack creates
a pipeline user, and the remaining two share the same pipeline user.
| test_interactive_pipeline_user_only_created_once | python | aws/aws-sam-cli | tests/integration/pipeline/test_bootstrap_command.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/pipeline/test_bootstrap_command.py | Apache-2.0 |
def get_kinesis_records(self, shard_id, sequence_number, stream_name):
"""Helper function to get kinesis records using the provided shard_id and sequence_number
Parameters
----------
shard_id: string
Shard Id to fetch the record from
sequence_number: string
... | Helper function to get kinesis records using the provided shard_id and sequence_number
Parameters
----------
shard_id: string
Shard Id to fetch the record from
sequence_number: string
Sequence number to get the record for
stream_name: string
N... | get_kinesis_records | python | aws/aws-sam-cli | tests/integration/remote/invoke/remote_invoke_integ_base.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/remote/invoke/remote_invoke_integ_base.py | Apache-2.0 |
def test_sync_infra_with_java(self, template_file):
"""This will test a case where user will flip ADL flag between sync sessions"""
template_path = str(self.test_data_path.joinpath(template_file))
stack_name = self._method_to_stack_name(self.id())
self.stacks.append({"name": stack_name})... | This will test a case where user will flip ADL flag between sync sessions | test_sync_infra_with_java | python | aws/aws-sam-cli | tests/integration/sync/test_sync_infra.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/sync/test_sync_infra.py | Apache-2.0 |
def run_initial_infra_validation(self) -> None:
"""Runs initial infra validation after deployment is completed"""
self.stack_resources = self._get_stacks(self.stack_name)
lambda_functions = self.stack_resources.get(AWS_LAMBDA_FUNCTION)
for lambda_function in lambda_functions:
... | Runs initial infra validation after deployment is completed | run_initial_infra_validation | python | aws/aws-sam-cli | tests/integration/sync/test_sync_watch.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/sync/test_sync_watch.py | Apache-2.0 |
def run_initial_infra_validation(self) -> None:
"""Runs initial infra validation after deployment is completed"""
self.stack_resources = self._get_stacks(self.stack_name)
lambda_functions = self.stack_resources.get(AWS_LAMBDA_FUNCTION)
for lambda_function in lambda_functions:
... | Runs initial infra validation after deployment is completed | run_initial_infra_validation | python | aws/aws-sam-cli | tests/integration/sync/test_sync_watch.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/sync/test_sync_watch.py | Apache-2.0 |
def test_must_send_experimental_metrics_if_experimental_command(self):
"""
Metrics should be sent if "Disabled via config file but Enabled via Envvar"
"""
# Disable it via configuration file
self.unset_config()
self.set_config(telemetry_enabled=True)
os.environ["S... |
Metrics should be sent if "Disabled via config file but Enabled via Envvar"
| test_must_send_experimental_metrics_if_experimental_command | python | aws/aws-sam-cli | tests/integration/telemetry/test_experimental_metric.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/telemetry/test_experimental_metric.py | Apache-2.0 |
def test_must_send_experimental_metrics_if_experimental_option(self):
"""
Metrics should be sent if "Disabled via config file but Enabled via Envvar"
"""
# Disable it via configuration file
self.unset_config()
self.set_config(telemetry_enabled=True)
os.environ["SA... |
Metrics should be sent if "Disabled via config file but Enabled via Envvar"
| test_must_send_experimental_metrics_if_experimental_option | python | aws/aws-sam-cli | tests/integration/telemetry/test_experimental_metric.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/telemetry/test_experimental_metric.py | Apache-2.0 |
def test_must_send_cdk_project_type_metrics(self):
"""
Metrics should be sent if "Disabled via config file but Enabled via Envvar"
"""
# Disable it via configuration file
self.unset_config()
self.set_config(telemetry_enabled=True)
os.environ["SAM_CLI_BETA_FEATURES... |
Metrics should be sent if "Disabled via config file but Enabled via Envvar"
| test_must_send_cdk_project_type_metrics | python | aws/aws-sam-cli | tests/integration/telemetry/test_experimental_metric.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/telemetry/test_experimental_metric.py | Apache-2.0 |
def test_must_send_not_experimental_metrics_if_not_experimental(self):
"""
Metrics should be sent if "Disabled via config file but Enabled via Envvar"
"""
# Disable it via configuration file
self.unset_config()
self.set_config(telemetry_enabled=True)
os.environ["S... |
Metrics should be sent if "Disabled via config file but Enabled via Envvar"
| test_must_send_not_experimental_metrics_if_not_experimental | python | aws/aws-sam-cli | tests/integration/telemetry/test_experimental_metric.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/telemetry/test_experimental_metric.py | Apache-2.0 |
def test_send_installed_metric_on_first_run(self):
"""
On the first run, send the installed metric
"""
self.unset_config()
with TelemetryServer() as server:
# Start the CLI
process = self.run_cmd()
_, stderrdata = process.communicate()
... |
On the first run, send the installed metric
| test_send_installed_metric_on_first_run | python | aws/aws-sam-cli | tests/integration/telemetry/test_installed_metric.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/telemetry/test_installed_metric.py | Apache-2.0 |
def test_must_not_send_installed_metric_when_prompt_is_disabled(self):
"""
If the Telemetry Prompt is not displayed, we must *not* send installed metric, even if Telemetry is enabled.
This happens on all subsequent runs.
"""
# Enable Telemetry. This will skip the Telemetry Promp... |
If the Telemetry Prompt is not displayed, we must *not* send installed metric, even if Telemetry is enabled.
This happens on all subsequent runs.
| test_must_not_send_installed_metric_when_prompt_is_disabled | python | aws/aws-sam-cli | tests/integration/telemetry/test_installed_metric.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/telemetry/test_installed_metric.py | Apache-2.0 |
def test_must_not_send_installed_metric_on_second_run(self):
"""
On first run, send installed metric. On second run, must *not* send installed metric
"""
# Unset config to show the prompt
self.unset_config()
with TelemetryServer() as server:
# First Run
... |
On first run, send installed metric. On second run, must *not* send installed metric
| test_must_not_send_installed_metric_on_second_run | python | aws/aws-sam-cli | tests/integration/telemetry/test_installed_metric.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/telemetry/test_installed_metric.py | Apache-2.0 |
def test_must_prompt_if_config_is_not_set(self):
"""
Must print prompt if Telemetry config is not set.
"""
self.unset_config()
process = self.run_cmd()
_, stderrdata = process.communicate()
# Telemetry prompt should be printed to the terminal
self.assert... |
Must print prompt if Telemetry config is not set.
| test_must_prompt_if_config_is_not_set | python | aws/aws-sam-cli | tests/integration/telemetry/test_prompt.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/telemetry/test_prompt.py | Apache-2.0 |
def test_must_not_prompt_if_config_is_set(self, telemetry_enabled, msg):
"""
If telemetry config is already set, prompt must not be displayed
"""
# Set the telemetry config
self.set_config(telemetry_enabled=telemetry_enabled)
process = self.run_cmd()
stdoutdata,... |
If telemetry config is already set, prompt must not be displayed
| test_must_not_prompt_if_config_is_set | python | aws/aws-sam-cli | tests/integration/telemetry/test_prompt.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/telemetry/test_prompt.py | Apache-2.0 |
def test_prompt_must_not_display_on_second_run(self):
"""
On first run, display the prompt. Do *not* display prompt on subsequent runs.
"""
self.unset_config()
# First Run
process = self.run_cmd()
_, stderrdata = process.communicate()
self.assertIn(EXPECT... |
On first run, display the prompt. Do *not* display prompt on subsequent runs.
| test_prompt_must_not_display_on_second_run | python | aws/aws-sam-cli | tests/integration/telemetry/test_prompt.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/telemetry/test_prompt.py | Apache-2.0 |
def test_must_not_send_metrics_if_disabled_using_envvar(self):
"""
No metrics should be sent if "Enabled via Config file but Disabled via Envvar"
"""
# Enable it via configuration file
self.set_config(telemetry_enabled=True)
with TelemetryServer() as server:
... |
No metrics should be sent if "Enabled via Config file but Disabled via Envvar"
| test_must_not_send_metrics_if_disabled_using_envvar | python | aws/aws-sam-cli | tests/integration/telemetry/test_telemetry_contract.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/telemetry/test_telemetry_contract.py | Apache-2.0 |
def test_must_send_metrics_if_enabled_via_envvar(self):
"""
Metrics should be sent if "Disabled via config file but Enabled via Envvar"
"""
# Disable it via configuration file
self.set_config(telemetry_enabled=False)
with TelemetryServer() as server:
# Run wi... |
Metrics should be sent if "Disabled via config file but Enabled via Envvar"
| test_must_send_metrics_if_enabled_via_envvar | python | aws/aws-sam-cli | tests/integration/telemetry/test_telemetry_contract.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/telemetry/test_telemetry_contract.py | Apache-2.0 |
def test_must_not_crash_when_offline(self):
"""
Must not crash the process if internet is not available
"""
self.set_config(telemetry_enabled=True)
# DO NOT START Telemetry Server here.
# Try to run the command without it.
# Start the CLI
process = self.... |
Must not crash the process if internet is not available
| test_must_not_crash_when_offline | python | aws/aws-sam-cli | tests/integration/telemetry/test_telemetry_contract.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/telemetry/test_telemetry_contract.py | Apache-2.0 |
def lambda_handler(event, context):
"""Sample pure Lambda function
Parameters
----------
event: dict, required
API Gateway Lambda Proxy Input Format
Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-fo... | Sample pure Lambda function
Parameters
----------
event: dict, required
API Gateway Lambda Proxy Input Format
Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format
context: object,... | lambda_handler | python | aws/aws-sam-cli | tests/integration/testdata/list/hello_world/app.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/testdata/list/hello_world/app.py | Apache-2.0 |
def _addMethod(self, effect, verb, resource, conditions):
"""Adds a method to the internal lists of allowed or denied methods. Each object in
the internal list contains a resource ARN and a condition statement. The condition
statement can be null."""
if verb != "*" and not hasattr(HttpVe... | Adds a method to the internal lists of allowed or denied methods. Each object in
the internal list contains a resource ARN and a condition statement. The condition
statement can be null. | _addMethod | python | aws/aws-sam-cli | tests/integration/testdata/start_api/lambda_authorizers/app.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/testdata/start_api/lambda_authorizers/app.py | Apache-2.0 |
def _getEmptyStatement(self, effect):
"""Returns an empty statement object prepopulated with the correct action and the
desired effect."""
statement = {
'Action': 'execute-api:Invoke',
'Effect': effect[:1].upper() + effect[1:].lower(),
'Resource': []
}... | Returns an empty statement object prepopulated with the correct action and the
desired effect. | _getEmptyStatement | python | aws/aws-sam-cli | tests/integration/testdata/start_api/lambda_authorizers/app.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/testdata/start_api/lambda_authorizers/app.py | Apache-2.0 |
def _getStatementForEffect(self, effect, methods):
"""This function loops over an array of objects containing a resourceArn and
conditions statement and generates the array of statements for the policy."""
statements = []
if len(methods) > 0:
statement = self._getEmptyStatem... | This function loops over an array of objects containing a resourceArn and
conditions statement and generates the array of statements for the policy. | _getStatementForEffect | python | aws/aws-sam-cli | tests/integration/testdata/start_api/lambda_authorizers/app.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/testdata/start_api/lambda_authorizers/app.py | Apache-2.0 |
def build(self):
"""Generates the policy document based on the internal lists of allowed and denied
conditions. This will generate a policy with two main statements for the effect:
one statement for Allow and one statement for Deny.
Methods that includes conditions will have their own st... | Generates the policy document based on the internal lists of allowed and denied
conditions. This will generate a policy with two main statements for the effect:
one statement for Allow and one statement for Deny.
Methods that includes conditions will have their own statement in the policy. | build | python | aws/aws-sam-cli | tests/integration/testdata/start_api/lambda_authorizers/app.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/testdata/start_api/lambda_authorizers/app.py | Apache-2.0 |
def lambda_handler(event, context):
"""Sample pure Lambda function that returns a message and a location"""
return {
"statusCode": 200,
"body": json.dumps({
"message": f"{layer_method()+2}",
"message_from_layer": f"{layer_method()}",
"extra_message": np.array... | Sample pure Lambda function that returns a message and a location | lambda_handler | python | aws/aws-sam-cli | tests/integration/testdata/sync/code/after/function/app.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/testdata/sync/code/after/function/app.py | Apache-2.0 |
def lambda_handler(event, context):
"""Sample pure Lambda function that returns a message and a location"""
return {
"statusCode": 200,
"body": json.dumps({
"message": f"{layer_method()+1}",
"message_from_layer": f"{layer_method()}",
"extra_message": np.array... | Sample pure Lambda function that returns a message and a location | lambda_handler | python | aws/aws-sam-cli | tests/integration/testdata/sync/code/before/function/app.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/testdata/sync/code/before/function/app.py | Apache-2.0 |
def lambda_handler(event, context):
"""Sample pure Lambda function that returns a message and a location"""
return {
"statusCode": 200,
"body": json.dumps({
"message": f"{layer_method()+2}",
"extra_message": np.array([1, 2, 3, 4, 5, 6]).tolist() # checking external libra... | Sample pure Lambda function that returns a message and a location | lambda_handler | python | aws/aws-sam-cli | tests/integration/testdata/sync/infra/after/Python/function/app.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/testdata/sync/infra/after/Python/function/app.py | Apache-2.0 |
def lambda_handler(event, context):
"""Sample pure Lambda function that returns a message and a location"""
return {
"statusCode": 200,
"body": json.dumps({
"message": f"{layer_method()+1}",
"extra_message": np.array([1, 2, 3, 4, 5, 6]).tolist() # checking external libra... | Sample pure Lambda function that returns a message and a location | lambda_handler | python | aws/aws-sam-cli | tests/integration/testdata/sync/infra/before/Python/function/app.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/testdata/sync/infra/before/Python/function/app.py | Apache-2.0 |
def lambda_handler(event, context):
"""Sample pure Lambda function that returns a message"""
return {
"statusCode": 200,
"body": json.dumps({
"message": "Hello world!",
}),
} | Sample pure Lambda function that returns a message | lambda_handler | python | aws/aws-sam-cli | tests/integration/testdata/sync/infra/before/Python/function_simple/app.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/testdata/sync/infra/before/Python/function_simple/app.py | Apache-2.0 |
def handler(event, context):
"""Sample pure Lambda function that returns a message and a location"""
return {
"statusCode": 200,
"body": json.dumps({
"message": f"{layer_method()+2}",
"extra_message": np.array([1, 2, 3, 4, 5, 6]).tolist() # checking external library call... | Sample pure Lambda function that returns a message and a location | handler | python | aws/aws-sam-cli | tests/integration/testdata/sync/infra/cdk/after/asset.6598609927b272b36fdf01072092f9851ddcd1b41ba294f736ce77091f5cc456/main.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/testdata/sync/infra/cdk/after/asset.6598609927b272b36fdf01072092f9851ddcd1b41ba294f736ce77091f5cc456/main.py | Apache-2.0 |
def handler(event, context):
"""Sample pure Lambda function that returns a message and a location"""
return {
"statusCode": 200,
"body": json.dumps({
"message": f"{layer_method()+2}",
"extra_message": np.array([1, 2, 3, 4, 5, 6]).tolist() # checking external library call... | Sample pure Lambda function that returns a message and a location | handler | python | aws/aws-sam-cli | tests/integration/testdata/sync/infra/cdk/after/asset.b998895901bf33127f2c9dce715854f8b35aa73fb7eb5245ba9721580bbe5837/main.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/testdata/sync/infra/cdk/after/asset.b998895901bf33127f2c9dce715854f8b35aa73fb7eb5245ba9721580bbe5837/main.py | Apache-2.0 |
def handler(event, context):
"""Sample pure Lambda function that returns a message and a location"""
return {
"statusCode": 200,
"body": json.dumps({
"message": f"{layer_method()+1}",
"extra_message": np.array([1, 2, 3, 4, 5, 6]).tolist() # checking external library call... | Sample pure Lambda function that returns a message and a location | handler | python | aws/aws-sam-cli | tests/integration/testdata/sync/infra/cdk/before/asset.6598609927b272b36fdf01072092f9851ddcd1b41ba294f736ce77091f5cc456/main.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/testdata/sync/infra/cdk/before/asset.6598609927b272b36fdf01072092f9851ddcd1b41ba294f736ce77091f5cc456/main.py | Apache-2.0 |
def handler(event, context):
"""Sample pure Lambda function that returns a message and a location"""
return {
"statusCode": 200,
"body": json.dumps({
"message": f"{layer_method()+1}",
"extra_message": np.array([1, 2, 3, 4, 5, 6]).tolist() # checking external library call... | Sample pure Lambda function that returns a message and a location | handler | python | aws/aws-sam-cli | tests/integration/testdata/sync/infra/cdk/before/asset.b998895901bf33127f2c9dce715854f8b35aa73fb7eb5245ba9721580bbe5837/main.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/testdata/sync/infra/cdk/before/asset.b998895901bf33127f2c9dce715854f8b35aa73fb7eb5245ba9721580bbe5837/main.py | Apache-2.0 |
def lambda_handler(event, context):
"""Sample pure Lambda function that returns a message and a location"""
return {
"statusCode": 200,
"body": json.dumps({
"message": f"{layer_method()+6}"
}),
} | Sample pure Lambda function that returns a message and a location | lambda_handler | python | aws/aws-sam-cli | tests/integration/testdata/sync/nested/after/child_stack/child_functions/child_function.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/testdata/sync/nested/after/child_stack/child_functions/child_function.py | Apache-2.0 |
def lambda_handler(event, context):
"""Sample pure Lambda function that returns a message and a location"""
try:
ip = requests.get("http://checkip.amazonaws.com/")
except requests.RequestException as e:
# Send some context about this error to Lambda Logs
print(e)
raise e
... | Sample pure Lambda function that returns a message and a location | lambda_handler | python | aws/aws-sam-cli | tests/integration/testdata/sync/nested/after/root_function/root_function.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/testdata/sync/nested/after/root_function/root_function.py | Apache-2.0 |
def lambda_handler(event, context):
"""Sample pure Lambda function that returns a message and a location"""
return {
"statusCode": 200,
"body": json.dumps({
"message": f"{layer_method()+5}"
}),
} | Sample pure Lambda function that returns a message and a location | lambda_handler | python | aws/aws-sam-cli | tests/integration/testdata/sync/nested/before/child_stack/child_functions/child_function.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/testdata/sync/nested/before/child_stack/child_functions/child_function.py | Apache-2.0 |
def lambda_handler(event, context):
"""Sample pure Lambda function that returns a message and a location"""
try:
ip = requests.get("http://checkip.amazonaws.com/")
except requests.RequestException as e:
# Send some context about this error to Lambda Logs
print(e)
raise e
... | Sample pure Lambda function that returns a message and a location | lambda_handler | python | aws/aws-sam-cli | tests/integration/testdata/sync/nested/before/root_function/root_function.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/testdata/sync/nested/before/root_function/root_function.py | Apache-2.0 |
def lambda_handler(event, context):
"""Sample pure Lambda function that returns a message and a location"""
try:
ip = requests.get("http://checkip.amazonaws.com/")
except requests.RequestException as e:
# Send some context about this error to Lambda Logs
print(e)
raise e
... | Sample pure Lambda function that returns a message and a location | lambda_handler | python | aws/aws-sam-cli | tests/integration/testdata/sync/nested_intrinsics/before/child_stack/child_function/function/function.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/testdata/sync/nested_intrinsics/before/child_stack/child_function/function/function.py | Apache-2.0 |
def test_cli_base(self):
"""
Just invoke the CLI without any commands and assert that help text was printed
:return:
"""
mock_cfg = Mock()
with patch("samcli.cli.main.GlobalConfig", mock_cfg):
runner = CliRunner()
result = runner.invoke(cli, [])
... |
Just invoke the CLI without any commands and assert that help text was printed
:return:
| test_cli_base | python | aws/aws-sam-cli | tests/unit/cli/test_main.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/cli/test_main.py | Apache-2.0 |
def test_must_return_many_functions_to_build(
self,
ContainerManagerMock,
pathlib_mock,
SamLayerProviderMock,
SamFunctionProviderMock,
get_buildable_stacks_mock,
get_template_data_mock,
):
"""
In this unit test, we also verify
- inlinec... |
In this unit test, we also verify
- inlinecode functions are skipped
- functions with codeuri pointing to a zip file are skipped
- layers without build method are skipped
- layers with codeuri pointing to a zip file are skipped
| test_must_return_many_functions_to_build | python | aws/aws-sam-cli | tests/unit/commands/buildcmd/test_build_context.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/commands/buildcmd/test_build_context.py | Apache-2.0 |
def test_latest_python_fetcher_has_valid_supported_runtimes(self):
"""
Mainly checks if the SUPPORTED_RUNTIMES constant actually has
Python runtime inside of it
"""
result = _get_latest_python_runtime()
self.assertTrue(result, "Python was not found in the SUPPORTED_RUNTIM... |
Mainly checks if the SUPPORTED_RUNTIMES constant actually has
Python runtime inside of it
| test_latest_python_fetcher_has_valid_supported_runtimes | python | aws/aws-sam-cli | tests/unit/commands/init/test_cli.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/commands/init/test_cli.py | Apache-2.0 |
def test_provider_with_multiple_stacks(self, method, func2_api_path, overridden_by_top_level_stack):
"""
Here we test func2 has the same path & method and different path/method
"""
template = {
"Resources": {
"SamFunc1": {
"Type": "AWS::Ser... |
Here we test func2 has the same path & method and different path/method
| test_provider_with_multiple_stacks | python | aws/aws-sam-cli | tests/unit/commands/local/lib/test_sam_api_provider.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/commands/local/lib/test_sam_api_provider.py | Apache-2.0 |
def make_swagger(routes, binary_media_types=None):
"""
Given a list of API configurations named tuples, returns a Swagger document
Parameters
----------
routes : list of samcli.commands.local.agiw.local_agiw_service.Route
binary_media_types : list of str
Returns
-------
dict
... |
Given a list of API configurations named tuples, returns a Swagger document
Parameters
----------
routes : list of samcli.commands.local.agiw.local_agiw_service.Route
binary_media_types : list of str
Returns
-------
dict
Swagger document
| make_swagger | python | aws/aws-sam-cli | tests/unit/commands/local/lib/test_sam_api_provider.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/commands/local/lib/test_sam_api_provider.py | Apache-2.0 |
def test_normalize_resource_path_symlink(self):
"""
template: tmp_dir/some/path/template.yaml
link1 (tmp_dir/symlinks/link1) -> ../some/path/template.yaml
link2 (tmp_dir/symlinks/link1) -> tmp_dir/symlinks/link1
resource_path (tmp_dir/some/path/src), raw path is "src"
The... |
template: tmp_dir/some/path/template.yaml
link1 (tmp_dir/symlinks/link1) -> ../some/path/template.yaml
link2 (tmp_dir/symlinks/link1) -> tmp_dir/symlinks/link1
resource_path (tmp_dir/some/path/src), raw path is "src"
The final expected value is the actual value of resource_path,... | test_normalize_resource_path_symlink | python | aws/aws-sam-cli | tests/unit/commands/local/lib/test_stack_provider.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/commands/local/lib/test_stack_provider.py | Apache-2.0 |
def test_undefined_payload_api_event(self, get_id_sources_mock, mock_lambda_uri):
"""
Tests if the payload version is set to 1.0 if it is not defined for API events
"""
mock_lambda_uri.get_function_name.return_value = "arn"
swagger_doc = {
"swagger": "2.0",
... |
Tests if the payload version is set to 1.0 if it is not defined for API events
| test_undefined_payload_api_event | python | aws/aws-sam-cli | tests/unit/commands/local/lib/swagger/test_parser.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/commands/local/lib/swagger/test_parser.py | Apache-2.0 |
def test_simple_response_override_using_rest_api(self, get_id_sources_mock, mock_lambda_uri):
"""
Tests the the Lambda authorizer's simple response property is set to False
if it is provided in a Swagger 2.0 document.
"""
mock_lambda_uri.get_function_name.return_value = "arn"
... |
Tests the the Lambda authorizer's simple response property is set to False
if it is provided in a Swagger 2.0 document.
| test_simple_response_override_using_rest_api | python | aws/aws-sam-cli | tests/unit/commands/local/lib/swagger/test_parser.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/commands/local/lib/swagger/test_parser.py | Apache-2.0 |
def test_ignore_token_auth_with_empty_id_sources(self, get_id_sources_mock, mock_lambda_uri):
"""
Test if we skip a token authorizer if identity source gathering method returns empty
"""
mock_lambda_uri.get_function_name.return_value = "arn"
get_id_sources_mock.return_value = []
... |
Test if we skip a token authorizer if identity source gathering method returns empty
| test_ignore_token_auth_with_empty_id_sources | python | aws/aws-sam-cli | tests/unit/commands/local/lib/swagger/test_parser.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/commands/local/lib/swagger/test_parser.py | Apache-2.0 |
def only_template_manifest_does_not_exist(args):
"""
Mock every file except the template manifest as its "existence" will
result in errors when it can't actually be read by `InteractiveInitFlow`.
"""
if args == Path("/any/existing/local/path/manifest.yaml"):
... |
Mock every file except the template manifest as its "existence" will
result in errors when it can't actually be read by `InteractiveInitFlow`.
| only_template_manifest_does_not_exist | python | aws/aws-sam-cli | tests/unit/commands/pipeline/init/test_initeractive_init_flow.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/commands/pipeline/init/test_initeractive_init_flow.py | Apache-2.0 |
def samconfig_parameters(cmd_names, config_dir=None, env=None, **kwargs):
"""
ContextManager to write a new SAM Config and remove the file after the contextmanager exists
Parameters
----------
cmd_names : list(str)
Name of the full commnad split as a list: ["generate-event", "s3", "put"]
... |
ContextManager to write a new SAM Config and remove the file after the contextmanager exists
Parameters
----------
cmd_names : list(str)
Name of the full commnad split as a list: ["generate-event", "s3", "put"]
config_dir : str
Path where the SAM config file should be written to. ... | samconfig_parameters | python | aws/aws-sam-cli | tests/unit/commands/samconfig/test_samconfig.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/commands/samconfig/test_samconfig.py | Apache-2.0 |
def assertListSubset(self, l1: Iterable, l2: Union[Iterable, Container], msg=None) -> None:
"""
Assert l2 contains all items in l1.
Just like calling self.assertIn(l1[x], l2) in a loop.
"""
for x in l1:
self.assertIn(x, l2, msg) |
Assert l2 contains all items in l1.
Just like calling self.assertIn(l1[x], l2) in a loop.
| assertListSubset | python | aws/aws-sam-cli | tests/unit/lib/deploy/test_deployer.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/lib/deploy/test_deployer.py | Apache-2.0 |
def test_must_paginate_using_next_token(self):
"""Make three API calls, first two returns a nextToken and last does not."""
token = "token"
expected_params = {"logGroupName": self.log_group_name, "interleaved": True}
expected_params_with_token = {"logGroupName": self.log_group_name, "int... | Make three API calls, first two returns a nextToken and last does not. | test_must_paginate_using_next_token | python | aws/aws-sam-cli | tests/unit/lib/observability/cw_logs/test_cw_log_puller.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/lib/observability/cw_logs/test_cw_log_puller.py | Apache-2.0 |
def test_resource_with_s3_url_dict(self, upload_local_artifacts_mock):
"""
Checks if we properly export from the Resource classc
:return:
"""
self.assertTrue(issubclass(ResourceWithS3UrlDict, Resource))
class MockResource(ResourceWithS3UrlDict):
PROPERTY_NAM... |
Checks if we properly export from the Resource classc
:return:
| test_resource_with_s3_url_dict | python | aws/aws-sam-cli | tests/unit/lib/package/test_artifact_exporter.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/lib/package/test_artifact_exporter.py | Apache-2.0 |
def test_get_current_route_keyerror(self):
"""
When the a HTTP request for given method+path combination is allowed by Flask but not in the list of routes,
something is messed up. Flask should be configured only from the list of routes.
"""
request_mock = Mock()
request_... |
When the a HTTP request for given method+path combination is allowed by Flask but not in the list of routes,
something is messed up. Flask should be configured only from the list of routes.
| test_get_current_route_keyerror | python | aws/aws-sam-cli | tests/unit/local/apigw/test_local_apigw_service.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/local/apigw/test_local_apigw_service.py | Apache-2.0 |
def test_must_create_container_with_required_values(self, mock_resolve_symlinks):
"""
Create a container with only required values. Optional values are not provided
:return:
"""
expected_volumes = {self.host_dir: {"bind": self.working_dir, "mode": "ro,delegated"}}
genera... |
Create a container with only required values. Optional values are not provided
:return:
| test_must_create_container_with_required_values | python | aws/aws-sam-cli | tests/unit/local/docker/test_container.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/local/docker/test_container.py | Apache-2.0 |
def test_must_create_container_including_all_optional_values(self, mock_resolve_symlinks):
"""
Create a container with required and optional values.
:return:
"""
expected_volumes = {
self.host_dir: {"bind": self.working_dir, "mode": "ro,delegated"},
"/som... |
Create a container with required and optional values.
:return:
| test_must_create_container_including_all_optional_values | python | aws/aws-sam-cli | tests/unit/local/docker/test_container.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/local/docker/test_container.py | Apache-2.0 |
def test_must_create_container_translate_volume_path(self, mock_resolve_symlinks, os_mock):
"""
Create a container with required and optional values, with windows style volume mount.
:return:
"""
os_mock.name = "nt"
host_dir = "C:\\Users\\Username\\AppData\\Local\\Temp\\... |
Create a container with required and optional values, with windows style volume mount.
:return:
| test_must_create_container_translate_volume_path | python | aws/aws-sam-cli | tests/unit/local/docker/test_container.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/local/docker/test_container.py | Apache-2.0 |
def test_must_connect_to_network_on_create(self, mock_resolve_symlinks):
"""
Create a container with only required values. Optional values are not provided
:return:
"""
expected_volumes = {self.host_dir: {"bind": self.working_dir, "mode": "ro,delegated"}}
network_id = "s... |
Create a container with only required values. Optional values are not provided
:return:
| test_must_connect_to_network_on_create | python | aws/aws-sam-cli | tests/unit/local/docker/test_container.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/local/docker/test_container.py | Apache-2.0 |
def test_must_connect_to_host_network_on_create(self, mock_resolve_symlinks):
"""
Create a container with only required values. Optional values are not provided
:return:
"""
expected_volumes = {self.host_dir: {"bind": self.working_dir, "mode": "ro,delegated"}}
network_id... |
Create a container with only required values. Optional values are not provided
:return:
| test_must_connect_to_host_network_on_create | python | aws/aws-sam-cli | tests/unit/local/docker/test_container.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/local/docker/test_container.py | Apache-2.0 |
def test_debug_arg_must_be_split_by_spaces_and_appended_to_bootstrap_based_entrypoint(self, runtime):
"""
Debug args list is appended as arguments to bootstrap-args, which is past the fourth position in the array
"""
expected_debug_args = ["a=b", "c=d", "e=f"]
result, _ = LambdaC... |
Debug args list is appended as arguments to bootstrap-args, which is past the fourth position in the array
| test_debug_arg_must_be_split_by_spaces_and_appended_to_bootstrap_based_entrypoint | python | aws/aws-sam-cli | tests/unit/local/docker/test_lambda_container.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/local/docker/test_lambda_container.py | Apache-2.0 |
def test_with_no_additional_variables(self):
"""
Test assuming user has *not* passed any environment variables. Only AWS variables should be setup
"""
expected = {
"AWS_SAM_LOCAL": "true",
"AWS_LAMBDA_FUNCTION_MEMORY_SIZE": "1024",
"AWS_LAMBDA_FUNCTIO... |
Test assuming user has *not* passed any environment variables. Only AWS variables should be setup
| test_with_no_additional_variables | python | aws/aws-sam-cli | tests/unit/local/lambdafn/test_env_vars.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/local/lambdafn/test_env_vars.py | Apache-2.0 |
def test_with_only_default_values_for_variables(self):
"""
Given only environment variable values, without any shell env values or overridden values
"""
expected = {
"AWS_SAM_LOCAL": "true",
"AWS_LAMBDA_FUNCTION_MEMORY_SIZE": "1024",
"AWS_LAMBDA_FUNCT... |
Given only environment variable values, without any shell env values or overridden values
| test_with_only_default_values_for_variables | python | aws/aws-sam-cli | tests/unit/local/lambdafn/test_env_vars.py | https://github.com/aws/aws-sam-cli/blob/master/tests/unit/local/lambdafn/test_env_vars.py | Apache-2.0 |
Subsets and Splits
Django Code with Docstrings
Filters Python code examples from Django repository that contain Django-related code, helping identify relevant code snippets for understanding Django framework usage patterns.
SQL Console for Shuu12121/python-treesitter-filtered-datasetsV2
Retrieves specific code examples from the Flask repository but doesn't provide meaningful analysis or patterns beyond basic data retrieval.
HTTPX Repo Code and Docstrings
Retrieves specific code examples from the httpx repository, which is useful for understanding how particular libraries are used but doesn't provide broader analytical insights about the dataset.
Requests Repo Docstrings & Code
Retrieves code examples with their docstrings and file paths from the requests repository, providing basic filtering but limited analytical value beyond finding specific code samples.
Quart Repo Docstrings & Code
Retrieves code examples with their docstrings from the Quart repository, providing basic code samples but offering limited analytical value for understanding broader patterns or relationships in the dataset.