Skip to content

Commit

Permalink
Incorporate review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesls committed May 27, 2015
1 parent 555c159 commit 9ef28c0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
19 changes: 15 additions & 4 deletions awscli/customizations/preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
import sys
import textwrap

from awscli.clidriver import CLICommand


logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -70,7 +68,7 @@ def mark_as_preview(command_table, session, **kwargs):
command_table[preview_service] = preview_cls(
cli_name=original_command.name,
session=session,
service_name=original_command._service_name,
service_name=original_command.service_model.service_name,
is_enabled=is_enabled)
# We also want to register a handler that will update the
# description in the docs to say that this is a preview service.
Expand All @@ -82,7 +80,20 @@ def mark_as_preview(command_table, session, **kwargs):
def update_description_with_preview(help_command, **kwargs):
style = help_command.doc.style
style.start_note()
style.bold("The service is currently in preview.")
style.bold(PreviewModeCommandMixin.HELP_SNIPPET.strip())
# bcdoc does not currently allow for what I'd like to do
# which is have a code block like:
#
# ::
# [preview]
# service=true
#
# aws configure set preview.service true
#
# So for now we're just going to add the configure command
# to enable this.
style.doc.write("You can enable this service by running: ")
style.code("aws configure set preview.%s true" % help_command.name)
style.end_note()


Expand Down
7 changes: 1 addition & 6 deletions tests/unit/customizations/test_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@ def test_preview_service_not_true(self):

def test_preview_service_enabled_makes_call(self):
self.full_config['preview'] = {'cloudfront': 'true'}
# Registering this handler will prevent the actual service
# call to cloudfront.
self.driver.session.register('calling-command.cloudfront',
lambda **kwargs: 0)
rc = self.driver.main('cloudfront list-distributions'.split())
self.assertEqual(rc, 0)
self.assert_params_for_cmd('cloudfront list-distributions', params={})

@mock.patch('awscli.help.get_renderer')
def test_can_still_document_preview_service(self, get_renderer):
Expand Down

0 comments on commit 9ef28c0

Please sign in to comment.