Skip to content

Commit

Permalink
Pass user provided api gateway stage to config
Browse files Browse the repository at this point in the history
We weren't passing this value to the factory obj
when creating the config so --api-gateway-stage
was being ignored.
  • Loading branch information
jamesls committed May 4, 2017
1 parent 568f5df commit a8eeed5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion chalice/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ def deploy(ctx, autogen_policy, profile, api_gateway_stage, stage,
factory = ctx.obj['factory'] # type: CLIFactory
factory.profile = profile
config = factory.create_config_obj(
chalice_stage_name=stage, autogen_policy=autogen_policy)
chalice_stage_name=stage, autogen_policy=autogen_policy,
api_gateway_stage=api_gateway_stage,
)
session = factory.create_botocore_session()
d = factory.create_default_deployer(session=session, prompter=click)
deployed_values = d.deploy(config, chalice_stage_name=stage)
Expand Down
15 changes: 15 additions & 0 deletions tests/functional/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,21 @@ def test_api_gateway_mutex_with_positional_arg(runner, mock_cli_factory,
assert not mock_deployer.deploy.called


def test_can_specify_api_gateway_stage(runner, mock_cli_factory,
mock_deployer):
with runner.isolated_filesystem():
cli.create_new_project_skeleton('testproject')
os.chdir('testproject')
result = _run_cli_command(runner, cli.deploy,
['--api-gateway-stage', 'notdev'],
cli_factory=mock_cli_factory)
assert result.exit_code == 0
mock_cli_factory.create_config_obj.assert_called_with(
autogen_policy=True, chalice_stage_name='dev',
api_gateway_stage='notdev'
)


def test_can_retrieve_url(runner, mock_cli_factory):
deployed_values = {
"dev": {
Expand Down

0 comments on commit a8eeed5

Please sign in to comment.