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 parse_template(template_str):
"""
Parse the SAM template.
:param template_str: A packaged YAML or json CloudFormation template
:type template_str: str
:return: Dictionary with keys defined in the template
:rtype: dict
"""
try:
# PyYAML doesn't support json as well as it shou... |
Parse the SAM template.
:param template_str: A packaged YAML or json CloudFormation template
:type template_str: str
:return: Dictionary with keys defined in the template
:rtype: dict
| parse_template | python | aws/aws-sam-cli | samcli/vendor/serverlessrepo/parser.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/vendor/serverlessrepo/parser.py | Apache-2.0 |
def get_app_metadata(template_dict):
"""
Get the application metadata from a SAM template.
:param template_dict: SAM template as a dictionary
:type template_dict: dict
:return: Application metadata as defined in the template
:rtype: ApplicationMetadata
:raises ApplicationMetadataNotFoundErr... |
Get the application metadata from a SAM template.
:param template_dict: SAM template as a dictionary
:type template_dict: dict
:return: Application metadata as defined in the template
:rtype: ApplicationMetadata
:raises ApplicationMetadataNotFoundError
| get_app_metadata | python | aws/aws-sam-cli | samcli/vendor/serverlessrepo/parser.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/vendor/serverlessrepo/parser.py | Apache-2.0 |
def parse_application_id(text):
"""
Extract the application id from input text.
:param text: text to parse
:type text: str
:return: application id if found in the input
:rtype: str
"""
result = re.search(APPLICATION_ID_PATTERN, text)
return result.group(0) if result else None |
Extract the application id from input text.
:param text: text to parse
:type text: str
:return: application id if found in the input
:rtype: str
| parse_application_id | python | aws/aws-sam-cli | samcli/vendor/serverlessrepo/parser.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/vendor/serverlessrepo/parser.py | Apache-2.0 |
def strip_app_metadata(template_dict):
"""
Strip the "AWS::ServerlessRepo::Application" metadata section from template.
:param template_dict: SAM template as a dictionary
:type template_dict: dict
:return: stripped template content
:rtype: str
"""
if SERVERLESS_REPO_APPLICATION not in t... |
Strip the "AWS::ServerlessRepo::Application" metadata section from template.
:param template_dict: SAM template as a dictionary
:type template_dict: dict
:return: stripped template content
:rtype: str
| strip_app_metadata | python | aws/aws-sam-cli | samcli/vendor/serverlessrepo/parser.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/vendor/serverlessrepo/parser.py | Apache-2.0 |
def publish_application(template, sar_client=None, fail_on_same_version=False):
"""
Create a new application or new application version in SAR.
Parameters
----------
template: str | dict
Content of a packaged YAML or JSON SAM template
sar_client: boto3.client
The boto3 client u... |
Create a new application or new application version in SAR.
Parameters
----------
template: str | dict
Content of a packaged YAML or JSON SAM template
sar_client: boto3.client
The boto3 client used to access SAR
fail_on_same_version: bool
Whether or not publish hard f... | publish_application | python | aws/aws-sam-cli | samcli/vendor/serverlessrepo/publish.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/vendor/serverlessrepo/publish.py | Apache-2.0 |
def _check_app_with_semantic_version_exists(sar_client, application_id, semantic_version):
"""
Checks if a given SAR application exists with a given semantic version
Parameters
----------
sar_client: boto3.client
The boto3 client used to access SAR
application_id: str
Applicati... |
Checks if a given SAR application exists with a given semantic version
Parameters
----------
sar_client: boto3.client
The boto3 client used to access SAR
application_id: str
Application Id to check
semantic_version: str
The semantic version to check with Application I... | _check_app_with_semantic_version_exists | python | aws/aws-sam-cli | samcli/vendor/serverlessrepo/publish.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/vendor/serverlessrepo/publish.py | Apache-2.0 |
def _get_template_dict(template):
"""
Parse string template and or copy dictionary template.
Parameters
----------
template: str | dict
Content of a packaged YAML or JSON SAM template
Returns
-------
dict
Template as a dictionary
Raises
------
ValueError
... |
Parse string template and or copy dictionary template.
Parameters
----------
template: str | dict
Content of a packaged YAML or JSON SAM template
Returns
-------
dict
Template as a dictionary
Raises
------
ValueError
If the supplied template is not a s... | _get_template_dict | python | aws/aws-sam-cli | samcli/vendor/serverlessrepo/publish.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/vendor/serverlessrepo/publish.py | Apache-2.0 |
def _create_application_request(app_metadata, template):
"""
Construct the request body to create application.
Parameters
----------
app_metadata: ApplicationMetadata
Object containing app metadata
template: str
A packaged YAML or JSON SAM template
Returns
-------
... |
Construct the request body to create application.
Parameters
----------
app_metadata: ApplicationMetadata
Object containing app metadata
template: str
A packaged YAML or JSON SAM template
Returns
-------
dict
SAR CreateApplication request body
| _create_application_request | python | aws/aws-sam-cli | samcli/vendor/serverlessrepo/publish.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/vendor/serverlessrepo/publish.py | Apache-2.0 |
def _update_application_request(app_metadata, application_id):
"""
Construct the request body to update application.
Parameters
----------
app_metadata: ApplicationMetadata
Object containing app metadata
application_id: str
The Amazon Resource Name (ARN) of the application
... |
Construct the request body to update application.
Parameters
----------
app_metadata: ApplicationMetadata
Object containing app metadata
application_id: str
The Amazon Resource Name (ARN) of the application
Returns
-------
dict
SAR CreateApplication request bo... | _update_application_request | python | aws/aws-sam-cli | samcli/vendor/serverlessrepo/publish.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/vendor/serverlessrepo/publish.py | Apache-2.0 |
def _create_application_version_request(app_metadata, application_id, template):
"""
Construct the request body to create application version.
Parameters
----------
app_metadata: ApplicationMetadata
Object containing app metadata
application_id: str
The Amazon Resource Name (AR... |
Construct the request body to create application version.
Parameters
----------
app_metadata: ApplicationMetadata
Object containing app metadata
application_id: str
The Amazon Resource Name (ARN) of the application
template: str
A packaged YAML or JSON SAM template
... | _create_application_version_request | python | aws/aws-sam-cli | samcli/vendor/serverlessrepo/publish.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/vendor/serverlessrepo/publish.py | Apache-2.0 |
def _is_conflict_exception(e):
"""
Check whether the botocore ClientError is ConflictException.
Parameters
----------
e: ClientError
botocore exception
Returns
-------
bool
True if e is ConflictException, False otherwise
"""
error_code = e.response["Error"]["Cod... |
Check whether the botocore ClientError is ConflictException.
Parameters
----------
e: ClientError
botocore exception
Returns
-------
bool
True if e is ConflictException, False otherwise
| _is_conflict_exception | python | aws/aws-sam-cli | samcli/vendor/serverlessrepo/publish.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/vendor/serverlessrepo/publish.py | Apache-2.0 |
def _wrap_client_error(e):
"""
Wrap botocore ClientError exception into ServerlessRepoClientError.
Parameters
----------
e: ClientError
botocore exception
Returns
-------
ServerlessRepoError
S3PermissionsRequired or InvalidS3UriError or general ServerlessRepoClientError
... |
Wrap botocore ClientError exception into ServerlessRepoClientError.
Parameters
----------
e: ClientError
botocore exception
Returns
-------
ServerlessRepoError
S3PermissionsRequired or InvalidS3UriError or general ServerlessRepoClientError
| _wrap_client_error | python | aws/aws-sam-cli | samcli/vendor/serverlessrepo/publish.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/vendor/serverlessrepo/publish.py | Apache-2.0 |
def _get_publish_details(actions, app_metadata_template):
"""
Get the changed application details after publishing.
Parameters
----------
actions: str | list
Actions taken during publishing
app_metadata_template: dict
Original template definitions of app metadata
Returns
... |
Get the changed application details after publishing.
Parameters
----------
actions: str | list
Actions taken during publishing
app_metadata_template: dict
Original template definitions of app metadata
Returns
-------
dict
Updated fields and values of the appl... | _get_publish_details | python | aws/aws-sam-cli | samcli/vendor/serverlessrepo/publish.py | https://github.com/aws/aws-sam-cli/blob/master/samcli/vendor/serverlessrepo/publish.py | Apache-2.0 |
def to_schema(self) -> Dict[str, Any]:
"""Return the JSON schema representation of the SAM CLI parameter."""
param: Dict[str, Any] = {}
param.update({"title": self.name, "type": self.type, "description": self.description})
if self.default:
param.update({"default": self.defaul... | Return the JSON schema representation of the SAM CLI parameter. | to_schema | python | aws/aws-sam-cli | schema/make_schema.py | https://github.com/aws/aws-sam-cli/blob/master/schema/make_schema.py | Apache-2.0 |
def to_schema(self) -> dict:
"""Return the JSON schema representation of the SAM CLI command."""
split_cmd_name = self.name.split("_")
formatted_cmd_name = " ".join(split_cmd_name)
formatted_params_list = "* " + "\n* ".join([f"{param.name}:\n{param.description}" for param in self.paramet... | Return the JSON schema representation of the SAM CLI command. | to_schema | python | aws/aws-sam-cli | schema/make_schema.py | https://github.com/aws/aws-sam-cli/blob/master/schema/make_schema.py | Apache-2.0 |
def clean_text(text: str) -> str:
"""Clean up a string of text to be formatted for the JSON schema."""
if not text:
return ""
for char_to_delete in CHARS_TO_CLEAN:
text = text.replace(char_to_delete, "")
return text.strip("\n").strip() | Clean up a string of text to be formatted for the JSON schema. | clean_text | python | aws/aws-sam-cli | schema/make_schema.py | https://github.com/aws/aws-sam-cli/blob/master/schema/make_schema.py | Apache-2.0 |
def format_param(param: click.core.Option) -> SamCliParameterSchema:
"""Format a click Option parameter to a SamCliParameter object.
A parameter object should contain the following information that will be
necessary for including in the JSON schema:
* name - The name of the parameter
* help - The p... | Format a click Option parameter to a SamCliParameter object.
A parameter object should contain the following information that will be
necessary for including in the JSON schema:
* name - The name of the parameter
* help - The parameter's description (may vary between commands)
* type - The data typ... | format_param | python | aws/aws-sam-cli | schema/make_schema.py | https://github.com/aws/aws-sam-cli/blob/master/schema/make_schema.py | Apache-2.0 |
def get_params_from_command(cli) -> List[SamCliParameterSchema]:
"""Given a CLI object, return a list of all parameters in that CLI, formatted as SamCliParameterSchema objects."""
return [
format_param(param)
for param in cli.params
if param.name and isinstance(param, click.core.Option) ... | Given a CLI object, return a list of all parameters in that CLI, formatted as SamCliParameterSchema objects. | get_params_from_command | python | aws/aws-sam-cli | schema/make_schema.py | https://github.com/aws/aws-sam-cli/blob/master/schema/make_schema.py | Apache-2.0 |
def retrieve_command_structure(package_name: str) -> List[SamCliCommandSchema]:
"""Given a SAM CLI package name, retrieve its structure.
Such a structure is the list of all subcommands as `SamCliCommandSchema`, which includes
the command's name, description, and its parameters.
Parameters
--------... | Given a SAM CLI package name, retrieve its structure.
Such a structure is the list of all subcommands as `SamCliCommandSchema`, which includes
the command's name, description, and its parameters.
Parameters
----------
package_name: str
The name of the command package to retrieve.
Retu... | retrieve_command_structure | python | aws/aws-sam-cli | schema/make_schema.py | https://github.com/aws/aws-sam-cli/blob/master/schema/make_schema.py | Apache-2.0 |
def generate_schema() -> dict:
"""Generate a JSON schema for all SAM CLI commands.
Returns
-------
dict
A dictionary representation of the JSON schema.
"""
schema: dict = {}
commands: List[SamCliCommandSchema] = []
# Populate schema with relevant attributes
schema["$schema"... | Generate a JSON schema for all SAM CLI commands.
Returns
-------
dict
A dictionary representation of the JSON schema.
| generate_schema | python | aws/aws-sam-cli | schema/make_schema.py | https://github.com/aws/aws-sam-cli/blob/master/schema/make_schema.py | Apache-2.0 |
def write_schema():
"""Generate the SAM CLI JSON schema and write it to file."""
schema = generate_schema()
with open(SchemaKeys.SCHEMA_FILE_NAME.value, "w+", encoding="utf-8") as outfile:
json.dump(schema, outfile, indent=2) | Generate the SAM CLI JSON schema and write it to file. | write_schema | python | aws/aws-sam-cli | schema/make_schema.py | https://github.com/aws/aws-sam-cli/blob/master/schema/make_schema.py | Apache-2.0 |
def get_managed_test_resource_outputs(session: Session):
"""Read output of the managed test resource stack for resource names and arns"""
cfn_resource = session.resource("cloudformation", config=DEFAULT_BOTO_CONFIG, region_name="us-east-1")
stack = cfn_resource.Stack(MANAGED_TEST_RESOURCE_STACK_NAME)
ou... | Read output of the managed test resource stack for resource names and arns | get_managed_test_resource_outputs | python | aws/aws-sam-cli | tests/get_testing_resources.py | https://github.com/aws/aws-sam-cli/blob/master/tests/get_testing_resources.py | Apache-2.0 |
def method_to_stack_name(method_name):
"""Method expects method name which can be a full path. Eg: test.integration.test_deploy_command.method_name"""
method_name = method_name.split(".")[-1]
stack_name = f"{method_name.replace('_', '-')}-{CFN_PYTHON_VERSION_SUFFIX}-{uuid4().hex}"
if not stack_name.star... | Method expects method name which can be a full path. Eg: test.integration.test_deploy_command.method_name | method_to_stack_name | python | aws/aws-sam-cli | tests/testing_utils.py | https://github.com/aws/aws-sam-cli/blob/master/tests/testing_utils.py | Apache-2.0 |
def start_persistent_process(
command_list: List[str],
cwd: Optional[str] = None,
) -> Popen:
"""Start a process with parameters that are suitable for persistent execution."""
return Popen(
command_list,
stdout=PIPE,
stderr=subprocess.STDOUT,
stdin=PIPE,
encoding=... | Start a process with parameters that are suitable for persistent execution. | start_persistent_process | python | aws/aws-sam-cli | tests/testing_utils.py | https://github.com/aws/aws-sam-cli/blob/master/tests/testing_utils.py | Apache-2.0 |
def kill_process(process: Popen) -> None:
"""Kills a process and it's children.
This loop ensures orphaned children are killed as well.
https://psutil.readthedocs.io/en/latest/#kill-process-tree
Raises ValueError if some processes are alive"""
root_process = psutil.Process(process.pid)
all_proce... | Kills a process and it's children.
This loop ensures orphaned children are killed as well.
https://psutil.readthedocs.io/en/latest/#kill-process-tree
Raises ValueError if some processes are alive | kill_process | python | aws/aws-sam-cli | tests/testing_utils.py | https://github.com/aws/aws-sam-cli/blob/master/tests/testing_utils.py | Apache-2.0 |
def read_until_string(process: Popen, expected_output: str, timeout: int = 30) -> None:
"""Read output from process until a line equals to expected_output has shown up or reaching timeout.
Throws TimeoutError if times out
"""
def _compare_output(output, _: List[str]) -> bool:
return bool(expect... | Read output from process until a line equals to expected_output has shown up or reaching timeout.
Throws TimeoutError if times out
| read_until_string | python | aws/aws-sam-cli | tests/testing_utils.py | https://github.com/aws/aws-sam-cli/blob/master/tests/testing_utils.py | Apache-2.0 |
def read_until(process: Popen, callback: Callable[[str, List[str]], bool], timeout: int = 5):
"""Read output from process until callback returns True or timeout is reached
Parameters
----------
process : Popen
callback : Callable[[str, List[str]], None]
Call when a new line is read from the... | Read output from process until callback returns True or timeout is reached
Parameters
----------
process : Popen
callback : Callable[[str, List[str]], None]
Call when a new line is read from the process.
timeout : int, optional
By default 5
Raises
------
TimeoutError
... | read_until | python | aws/aws-sam-cli | tests/testing_utils.py | https://github.com/aws/aws-sam-cli/blob/master/tests/testing_utils.py | Apache-2.0 |
def create_file(self, filename, contents, mtime=None, mode="w"):
"""Creates a file in a tmpdir
``filename`` should be a relative path, e.g. "foo/bar/baz.txt"
It will be translated into a full path in a tmp dir.
If the ``mtime`` argument is provided, then the file's
mtime will be ... | Creates a file in a tmpdir
``filename`` should be a relative path, e.g. "foo/bar/baz.txt"
It will be translated into a full path in a tmp dir.
If the ``mtime`` argument is provided, then the file's
mtime will be set to the provided value (must be an epoch time).
Otherwise the mti... | create_file | python | aws/aws-sam-cli | tests/testing_utils.py | https://github.com/aws/aws-sam-cli/blob/master/tests/testing_utils.py | Apache-2.0 |
def append_file(self, filename, contents):
"""Append contents to a file
``filename`` should be a relative path, e.g. "foo/bar/baz.txt"
It will be translated into a full path in a tmp dir.
Returns the full path to the file.
"""
full_path = os.path.join(self.rootdir, filena... | Append contents to a file
``filename`` should be a relative path, e.g. "foo/bar/baz.txt"
It will be translated into a full path in a tmp dir.
Returns the full path to the file.
| append_file | python | aws/aws-sam-cli | tests/testing_utils.py | https://github.com/aws/aws-sam-cli/blob/master/tests/testing_utils.py | Apache-2.0 |
def strip_nightly_installer_suffix(request: dict, metric_type: str):
"""
If it's a nightly release version, it will have a suffix.
We can strip it for the purpose of testing telemetry.
"""
metrics = request.get("data", {}).get("metrics", [])
if not metrics:
return
version = metrics[0... |
If it's a nightly release version, it will have a suffix.
We can strip it for the purpose of testing telemetry.
| strip_nightly_installer_suffix | python | aws/aws-sam-cli | tests/testing_utils.py | https://github.com/aws/aws-sam-cli/blob/master/tests/testing_utils.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/functional/testdata/init/unknown_runtime/python3.8/cookiecutter-aws-sam-hello/{{cookiecutter.project_name}}/hello_world/app.py | https://github.com/aws/aws-sam-cli/blob/master/tests/functional/testdata/init/unknown_runtime/python3.8/cookiecutter-aws-sam-hello/{{cookiecutter.project_name}}/hello_world/app.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/functional/testdata/init/unknown_runtime/random.runtime1/cookiecutter-aws-sam-hello/{{cookiecutter.project_name}}/hello_world/app.py | https://github.com/aws/aws-sam-cli/blob/master/tests/functional/testdata/init/unknown_runtime/random.runtime1/cookiecutter-aws-sam-hello/{{cookiecutter.project_name}}/hello_world/app.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/functional/testdata/init/unknown_runtime/random.runtime2/cookiecutter-aws-sam-hello/{{cookiecutter.project_name}}/hello_world/app.py | https://github.com/aws/aws-sam-cli/blob/master/tests/functional/testdata/init/unknown_runtime/random.runtime2/cookiecutter-aws-sam-hello/{{cookiecutter.project_name}}/hello_world/app.py | Apache-2.0 |
def _verify_build(self, function_full_paths, layer_full_path, stack_paths, command_result):
"""
Verify resources have their build artifact folders, stack has their own template.yaml, and command succeeds.
"""
self._verify_process_code_and_output(command_result, function_full_paths, layer... |
Verify resources have their build artifact folders, stack has their own template.yaml, and command succeeds.
| _verify_build | python | aws/aws-sam-cli | tests/integration/buildcmd/build_integ_base.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/buildcmd/build_integ_base.py | Apache-2.0 |
def _verify_invoke_built_functions(self, template_path, functions, error_message):
"""
Invoke the function, if error_message is not None, the invoke should fail.
"""
for function_logical_id in functions:
LOG.info("Invoking built function '{}'".format(function_logical_id))
... |
Invoke the function, if error_message is not None, the invoke should fail.
| _verify_invoke_built_functions | python | aws/aws-sam-cli | tests/integration/buildcmd/build_integ_base.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/buildcmd/build_integ_base.py | Apache-2.0 |
def rust_parameterized_class(cls):
"""
common class parameterize for rust integration tests
"""
cls = parameterized_class(
("template", "code_uri", "binary", "expected_invoke_result"),
[
(
"template_build_method_rust_single_function.yaml",
"Rus... |
common class parameterize for rust integration tests
| rust_parameterized_class | python | aws/aws-sam-cli | tests/integration/buildcmd/build_integ_base.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/buildcmd/build_integ_base.py | Apache-2.0 |
def test_dedup_build(self):
"""
Build template above and verify that each function call returns as expected
"""
overrides = {
"Function1Handler": "main.first_function_handler",
"Function2Handler": "main.second_function_handler",
"FunctionRuntime": "3.1... |
Build template above and verify that each function call returns as expected
| test_dedup_build | python | aws/aws-sam-cli | tests/integration/buildcmd/test_build_cmd.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/buildcmd/test_build_cmd.py | Apache-2.0 |
def test_dedup_build_makefile(self):
"""
Build template above in the container and verify that each function call returns as expected
"""
cmdlist = self.get_command_list(beta_features=self.beta_features)
# Built using `native` python-pip builder for a python project.
com... |
Build template above in the container and verify that each function call returns as expected
| test_dedup_build_makefile | python | aws/aws-sam-cli | tests/integration/buildcmd/test_build_cmd.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/buildcmd/test_build_cmd.py | Apache-2.0 |
def test_cached_build_with_env_vars(self):
"""
Build 2 times to verify that second time hits the cached build
"""
overrides = {
"FunctionCodeUri": "Python",
"Function1Handler": "main.first_function_handler",
"Function2Handler": "main.second_function_ha... |
Build 2 times to verify that second time hits the cached build
| test_cached_build_with_env_vars | python | aws/aws-sam-cli | tests/integration/buildcmd/test_build_cmd.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/buildcmd/test_build_cmd.py | Apache-2.0 |
def test_repeated_cached_build_hits_cache(self, use_container):
"""
Build 2 times to verify that second time hits the cached build
"""
if use_container and (SKIP_DOCKER_TESTS or SKIP_DOCKER_BUILD):
self.skipTest(SKIP_DOCKER_MESSAGE)
parameter_overrides = {
... |
Build 2 times to verify that second time hits the cached build
| test_repeated_cached_build_hits_cache | python | aws/aws-sam-cli | tests/integration/buildcmd/test_build_cmd.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/buildcmd/test_build_cmd.py | Apache-2.0 |
def test_dedup_build(self, use_container, code_uri, function1_handler, function2_handler, runtime):
"""
Build template above and verify that each function call returns as expected
"""
if use_container and (SKIP_DOCKER_TESTS or SKIP_DOCKER_BUILD):
self.skipTest(SKIP_DOCKER_MES... |
Build template above and verify that each function call returns as expected
| test_dedup_build | python | aws/aws-sam-cli | tests/integration/buildcmd/test_build_cmd.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/buildcmd/test_build_cmd.py | Apache-2.0 |
def test_dedup_build(self):
"""
Build template above and verify that each function call returns as expected
"""
cmdlist = self.get_command_list(parallel=True, beta_features=self.beta_features)
command_result = run_command(cmdlist, cwd=self.working_dir)
self.assertEqual(... |
Build template above and verify that each function call returns as expected
| test_dedup_build | python | aws/aws-sam-cli | tests/integration/buildcmd/test_build_cmd.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/buildcmd/test_build_cmd.py | Apache-2.0 |
def test_nested_build(self, use_container, cached, parallel):
"""
Build template above and verify that each function call returns as expected
"""
overrides = {
"Runtime": "3.11",
"DockerFile": "Dockerfile",
"Tag": f"{random.randint(1,100)}",
... |
Build template above and verify that each function call returns as expected
| test_nested_build | python | aws/aws-sam-cli | tests/integration/buildcmd/test_build_cmd.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/buildcmd/test_build_cmd.py | Apache-2.0 |
def setUpClass(cls):
"""Setting up a S3 bucket (using pre-created or create a new bucket) to use as a Terraform backend"""
cls.region_name = os.environ.get("AWS_DEFAULT_REGION", "us-east-1")
"""Please read comments in package_integ_base.py for more details around this."""
bucket_env_var... | Setting up a S3 bucket (using pre-created or create a new bucket) to use as a Terraform backend | setUpClass | python | aws/aws-sam-cli | tests/integration/buildcmd/test_build_terraform_applications.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/buildcmd/test_build_terraform_applications.py | Apache-2.0 |
def tearDownClass(cls):
"""Clean up and delete the bucket if it is not pre-created"""
cls.s3_bucket.objects.all().delete()
time.sleep(S3_SLEEP)
if not cls.pre_created_bucket:
cls.s3_bucket.delete() | Clean up and delete the bucket if it is not pre-created | tearDownClass | python | aws/aws-sam-cli | tests/integration/buildcmd/test_build_terraform_applications.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/buildcmd/test_build_terraform_applications.py | Apache-2.0 |
def tearDown(self):
"""Clean up the terraform state file on S3 and remove the backendconfg locally"""
self.s3_bucket.delete_objects(Delete={"Objects": [{"Key": self.backend_key}]})
time.sleep(S3_SLEEP)
try:
Path(self.backendconfig_path).unlink()
except FileNotFoundErr... | Clean up the terraform state file on S3 and remove the backendconfg locally | tearDown | python | aws/aws-sam-cli | tests/integration/buildcmd/test_build_terraform_applications.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/buildcmd/test_build_terraform_applications.py | Apache-2.0 |
def _validate_stack_deleted(self, stack_name: str) -> None:
"""
Validates that the stack is deleted from Cloudformation
Parameters
----------
stack_name: str
The name of the stack to check if it exists in Cloudformation
"""
try:
self.cf_cl... |
Validates that the stack is deleted from Cloudformation
Parameters
----------
stack_name: str
The name of the stack to check if it exists in Cloudformation
| _validate_stack_deleted | python | aws/aws-sam-cli | tests/integration/delete/test_delete_command.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/delete/test_delete_command.py | Apache-2.0 |
def _method_to_stack_name(self, method_name):
"""Method expects method name which can be a full path. Eg: test.integration.test_deploy_command.method_name"""
method_name = method_name.split(".")[-1]
return f"{method_name.replace('_', '-')}-{CFN_PYTHON_VERSION_SUFFIX}" | Method expects method name which can be a full path. Eg: test.integration.test_deploy_command.method_name | _method_to_stack_name | python | aws/aws-sam-cli | tests/integration/delete/test_delete_command.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/delete/test_delete_command.py | Apache-2.0 |
def test_deploy_with_code_signing_params(self, should_sign, should_enforce, will_succeed):
"""
Signed function with UntrustedArtifactOnDeployment = Enforced config should succeed
Signed function with UntrustedArtifactOnDeployment = Warn config should succeed
Unsigned function with Untrus... |
Signed function with UntrustedArtifactOnDeployment = Enforced config should succeed
Signed function with UntrustedArtifactOnDeployment = Warn config should succeed
Unsigned function with UntrustedArtifactOnDeployment = Enforce config should fail
Unsigned function with UntrustedArtifactO... | test_deploy_with_code_signing_params | python | aws/aws-sam-cli | tests/integration/deploy/test_deploy_command.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/deploy/test_deploy_command.py | Apache-2.0 |
def _assert_template_with_cfn_lint(self, cwd):
"""Assert if the generated project passes cfn-lint"""
cmd_list = [
get_sam_command(),
"validate",
"--lint",
]
result = run_command(cmd_list, cwd=cwd)
self.assertEqual(result.process.returncode, 0) | Assert if the generated project passes cfn-lint | _assert_template_with_cfn_lint | python | aws/aws-sam-cli | tests/integration/init/test_init_command.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/init/test_init_command.py | Apache-2.0 |
def _create_cred_profile(self, profile_name, access_key, secret_key, session_token=None):
"""
Method to create aws credentials entry similar to ~/.aws/credentials file format.
"""
cred_profile_content = f"""
[{profile_name}]
aws_access_key_id = {access_key}
aws_secret_access_key = {secre... |
Method to create aws credentials entry similar to ~/.aws/credentials file format.
| _create_cred_profile | python | aws/aws-sam-cli | tests/integration/init/schemas/schemas_test_data_setup.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/init/schemas/schemas_test_data_setup.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/invoke/test_invoke_terraform_applications.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/invoke/test_invoke_terraform_applications.py | Apache-2.0 |
def test_build_and_invoke_functions(self, function_name):
"""
This method will first build functions (which contains a credentials call)
Then invoke each of them with passing AWS session env variables
"""
# first build application
build_command_list = self.get_build_comma... |
This method will first build functions (which contains a credentials call)
Then invoke each of them with passing AWS session env variables
| test_build_and_invoke_functions | python | aws/aws-sam-cli | tests/integration/local/invoke/test_with_credentials.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/invoke/test_with_credentials.py | Apache-2.0 |
def test_build_and_invoke_functions(self, function_name):
"""
This method will first build functions (which contains a credentials call)
Then invoke each of them with passing AWS session env variables
"""
# first build application
build_command_list = self.get_build_comma... |
This method will first build functions (which contains a credentials call)
Then invoke each of them with passing AWS session env variables
| test_build_and_invoke_functions | python | aws/aws-sam-cli | tests/integration/local/invoke/test_with_credentials.py | https://github.com/aws/aws-sam-cli/blob/master/tests/integration/local/invoke/test_with_credentials.py | Apache-2.0 |
def test_get_call_with_path_setup_with_any_implicit_api_http10(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_code, 200)
... |
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_http10 | 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_http10(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(response.status_... |
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_http10 | 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_http10(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(response.status_cod... |
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_http10 | 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_head_call_with_path_setup_with_any_implicit_api_http10(self):
"""
Head Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.head(self.url + "/anyandall", timeout=300)
self.assertEqual(response.status_code, 200... |
Head Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_head_call_with_path_setup_with_any_implicit_api_http10 | 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_implicit_api_http10(self):
"""
Delete Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.delete(self.url + "/anyandall", timeout=300)
self.assertEqual(response.status_cod... |
Delete Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_delete_call_with_path_setup_with_any_implicit_api_http10 | 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_options_call_with_path_setup_with_any_implicit_api_http10(self):
"""
Options Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.options(self.url + "/anyandall", timeout=300)
self.assertEqual(response.status_... |
Options Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_options_call_with_path_setup_with_any_implicit_api_http10 | 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_implicit_api_http10(self):
"""
Patch Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.patch(self.url + "/anyandall", timeout=300)
self.assertEqual(response.status_code, ... |
Patch Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_patch_call_with_path_setup_with_any_implicit_api_http10 | 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_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_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_different_endpoints(self):
"""
Send two requests to different paths at the same time. This is to ensure we can handle
multiple requests for different paths and do not block/queue up the requests
"""
number_of_requests = 10
start_time = time()
with ThreadP... |
Send two requests to different paths at the same time. This is to ensure we can handle
multiple requests for different paths and do not block/queue up the requests
| test_different_endpoints | 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(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_code, 200)
... |
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 | 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(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(response.status_code, 2... |
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 | 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(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(response.status_code, 200)... |
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 | 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_head_call_with_path_setup_with_any_implicit_api(self):
"""
Head Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.head(self.url + "/anyandall", timeout=300)
self.assertEqual(response.status_code, 200)
... |
Head Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_head_call_with_path_setup_with_any_implicit_api | 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_implicit_api(self):
"""
Delete Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.delete(self.url + "/anyandall", timeout=300)
self.assertEqual(response.status_code, 200)... |
Delete Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_delete_call_with_path_setup_with_any_implicit_api | 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_options_call_with_path_setup_with_any_implicit_api(self):
"""
Options Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.options(self.url + "/anyandall", timeout=300)
self.assertEqual(response.status_code, 2... |
Options Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_options_call_with_path_setup_with_any_implicit_api | 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_implicit_api(self):
"""
Patch Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.patch(self.url + "/anyandall", timeout=300)
self.assertEqual(response.status_code, 200)
... |
Patch Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_patch_call_with_path_setup_with_any_implicit_api | 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(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_code, 200)
... |
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 | 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(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(response.status_code, 2... |
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 | 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(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(response.status_code, 200)... |
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 | 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_head_call_with_path_setup_with_any_implicit_api(self):
"""
Head Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.head(self.url + "/anyandall", timeout=300)
self.assertEqual(response.status_code, 200)
... |
Head Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_head_call_with_path_setup_with_any_implicit_api | 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_implicit_api(self):
"""
Delete Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.delete(self.url + "/anyandall", timeout=300)
self.assertEqual(response.status_code, 200)... |
Delete Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_delete_call_with_path_setup_with_any_implicit_api | 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_options_call_with_path_setup_with_any_implicit_api(self):
"""
Options Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.options(self.url + "/anyandall", timeout=300)
self.assertEqual(response.status_code, 2... |
Options Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_options_call_with_path_setup_with_any_implicit_api | 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_implicit_api(self):
"""
Patch Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.patch(self.url + "/anyandall", timeout=300)
self.assertEqual(response.status_code, 200)
... |
Patch Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_patch_call_with_path_setup_with_any_implicit_api | 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_valid_v2_lambda_json_response(self):
"""
Patch Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.get(self.url + "/validv2responsehash", timeout=300)
self.assertEqual(response.status_code, 200)
self.... |
Patch Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_valid_v2_lambda_json_response | 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_invalid_v1_lambda_json_response(self):
"""
Patch Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.get(self.url + "/invalidv1responsehash", timeout=300)
self.assertEqual(response.status_code, 502)
s... |
Patch Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_invalid_v1_lambda_json_response | 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_valid_v2_lambda_string_response(self):
"""
Patch Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.get(self.url + "/validv2responsestring", timeout=300)
self.assertEqual(response.status_code, 200)
s... |
Patch Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_valid_v2_lambda_string_response | 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_valid_v2_lambda_integer_response(self):
"""
Patch Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.get(self.url + "/validv2responseinteger", timeout=300)
self.assertEqual(response.status_code, 200)
... |
Patch Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_valid_v2_lambda_integer_response | 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_v2_lambda_response_skip_unexpected_fields(self):
"""
Patch Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.get(self.url + "/invalidv2response", timeout=300)
self.assertEqual(response.status_code, 200)
... |
Patch Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_v2_lambda_response_skip_unexpected_fields | 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_invalid_v1_lambda_string_response(self):
"""
Patch Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
"""
response = requests.get(self.url + "/invalidv1responsestring", timeout=300)
self.assertEqual(response.status_code, 502)
... |
Patch Request to a path that was defined as ANY in SAM through AWS::Serverless::Function Events
| test_invalid_v1_lambda_string_response | 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 + "/anyandall", timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json... |
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_parse_swagger_body_with_non_case_sensitive_integration_type(self):
"""
Get Request to a path that was defined as ANY in SAM through Swagger
"""
response = requests.get(self.url + "/nonsensitiveanyandall", timeout=300)
self.assertEqual(response.status_code, 200)
... |
Get Request to a path that was defined as ANY in SAM through Swagger
| test_parse_swagger_body_with_non_case_sensitive_integration_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_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 + "/anyandall", json={}, timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(r... |
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 + "/anyandall", json={}, timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(resp... |
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 + "/anyandall", timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(resp... |
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 + "/anyandall", timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(respons... |
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 + "/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_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 + "/httpapi-anyandall", timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(respo... |
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 + "/httpapi-anyandall", json={}, timeout=300)
self.assertEqual(response.status_code, 200)
self.asser... |
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 + "/httpapi-anyandall", json={}, timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEq... |
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 + "/httpapi-anyandall", timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEq... |
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 + "/httpapi-anyandall", timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual... |
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_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 + "/anyandall", timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json... |
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 + "/anyandall", json={}, timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(r... |
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 + "/anyandall", json={}, timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(resp... |
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 + "/anyandall", timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(resp... |
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 + "/anyandall", timeout=300)
self.assertEqual(response.status_code, 200)
self.assertEqual(respons... |
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 |
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.