def do_command(self): app_name = self.get_app_name() print_policy = getattr(self.app.pargs, 'print') if print_policy: lifecycleops.print_lifecycle_policy(app_name) return lifecycleops.interactive_update_lifcycle_policy(app_name)
def do_command(self): app_name = self.get_app_name() print_policy = getattr(self.app.pargs, 'print') if print_policy is not None and print_policy: lifecycleops.print_lifecycle_policy(app_name) return # If no flags are set run interactive lifecycleops.interactive_update_lifcycle_policy(app_name)
def test_interactive_update_lifecycle_policy_bad_user_input( self, mock_lifecycle_config): self.mock_beanstalk.describe_application.return_value = self.app_response mock_lifecycle_config.return_value = mock_lifecycle_config mock_lifecycle_config.convert_api_to_usr_model.return_value = self.usr_model self.mock_fileops.save_app_file.return_value = self.file_location self.mock_fileops.get_application_from_file.side_effect = InvalidSyntaxError( "Bad syntax in config.") lifecycleops.interactive_update_lifcycle_policy(self.app_name) self.mock_beanstalk.describe_application.assert_called_with( self.app_name) mock_lifecycle_config.assert_called_with(self.app_response) self.mock_fileops.save_app_file.assert_called_with(self.usr_model) self.mock_fileops.open_file_for_editing.assert_called_with( self.file_location) self.mock_fileops.get_application_from_file.assert_called_with( self.app_name) mock_lifecycle_config.collect_changes.assert_not_called() self.mock_fileops.delete_app_file.assert_called_with(self.app_name) self.mock_beanstalk.update_application_resource_lifecycle.assert_not_called( )
def test_interactive_update_lifecycle_policy(self, mock_lifecycle_config): self.mock_beanstalk.describe_application.return_value = self.app_response mock_lifecycle_config.return_value = mock_lifecycle_config mock_lifecycle_config.convert_api_to_usr_model.return_value = self.usr_model self.mock_fileops.save_app_file.return_value = self.file_location self.mock_fileops.get_application_from_file.return_value = self.usr_model mock_lifecycle_config.collect_changes.return_value = self.usr_model lifecycleops.interactive_update_lifcycle_policy(self.app_name) self.mock_beanstalk.describe_application.assert_called_with( self.app_name) mock_lifecycle_config.assert_called_with(self.app_response) self.mock_fileops.save_app_file.assert_called_with(self.usr_model) self.mock_fileops.open_file_for_editing.assert_called_with( self.file_location) self.mock_fileops.get_application_from_file.assert_called_with( self.app_name) mock_lifecycle_config.collect_changes.assert_called_with( self.usr_model) self.mock_fileops.delete_app_file.assert_called_with(self.app_name) self.mock_beanstalk.update_application_resource_lifecycle.assert_called_with( self.app_name, self.usr_model)
def interactive_lifecycle(self, t): """Always return back to the table""" self.flusher(t) io.echo('\n') interactive_update_lifcycle_policy(self.poller.app_name) time.sleep(4)
def interactive_lifecycle(self, t): """Always return back to the table""" self.flusher(t) io.echo('\n') interactive_update_lifcycle_policy(self.poller.app_name) time.sleep(4)