From 9ef28c0a661e1935bf9fb3964d8d2b396e9498f0 Mon Sep 17 00:00:00 2001 From: James Saryerwinnie Date: Wed, 27 May 2015 12:26:38 -0700 Subject: [PATCH] Incorporate review feedback --- awscli/customizations/preview.py | 19 +++++++++++++++---- tests/unit/customizations/test_preview.py | 7 +------ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/awscli/customizations/preview.py b/awscli/customizations/preview.py index 28801f2a5666..ce4432224cee 100644 --- a/awscli/customizations/preview.py +++ b/awscli/customizations/preview.py @@ -33,8 +33,6 @@ import sys import textwrap -from awscli.clidriver import CLICommand - logger = logging.getLogger(__name__) @@ -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. @@ -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() diff --git a/tests/unit/customizations/test_preview.py b/tests/unit/customizations/test_preview.py index e2a80fe347a2..6206b48795a1 100644 --- a/tests/unit/customizations/test_preview.py +++ b/tests/unit/customizations/test_preview.py @@ -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):