Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Don't set default value for --region #811

Merged
merged 3 commits into from
Nov 30, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samcli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
SAM CLI version
"""

__version__ = '0.8.0'
__version__ = '0.8.1'
1 change: 0 additions & 1 deletion samcli/cli/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def callback(ctx, param, value):
return click.option('--region',
expose_value=False,
help='Set the AWS Region of the service (e.g. us-east-1).',
default='us-east-1',
callback=callback)(f)


Expand Down
29 changes: 29 additions & 0 deletions tests/integration/local/invoke/test_integrations_cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import shutil
import os
import copy

from nose_parameterized import parameterized
from subprocess import Popen, PIPE
Expand Down Expand Up @@ -176,6 +177,34 @@ def test_invoke_with_env_using_parameters_with_custom_region(self):

self.assertEquals(environ["Region"], custom_region)

def test_invoke_with_env_with_aws_creds(self):
custom_region = "my-custom-region"
key = "key"
secret = "secret"
session = "session"

command_list = self.get_command_list("EchoEnvWithParameters",
template_path=self.template_path,
event_path=self.event_path)

env = copy.deepcopy(os.environ)
env["AWS_DEFAULT_REGION"] = custom_region
env["AWS_REGION"] = custom_region
env["AWS_ACCESS_KEY_ID"] = key
env["AWS_SECRET_ACCESS_KEY"] = secret
env["AWS_SESSION_TOKEN"] = session

process = Popen(command_list, stdout=PIPE, env=env)
process.wait()
process_stdout = b"".join(process.stdout.readlines()).strip()
environ = json.loads(process_stdout.decode('utf-8'))

self.assertEquals(environ["AWS_DEFAULT_REGION"], custom_region)
self.assertEquals(environ["AWS_REGION"], custom_region)
self.assertEquals(environ["AWS_ACCESS_KEY_ID"], key)
self.assertEquals(environ["AWS_SECRET_ACCESS_KEY"], secret)
self.assertEquals(environ["AWS_SESSION_TOKEN"], session)

def test_invoke_with_docker_network_of_host(self):
command_list = self.get_command_list("HelloWorldServerlessFunction",
template_path=self.template_path,
Expand Down