def test_check_action_commands_invalid(): ctx = Mock(side_effect=Exception("failed")) try: input_checks.check_action_command(ctx, "burger_and_fries") except Exception: pass # py 3.6: ctx.fail.assert_called() assert 'call.fail(' in str(ctx.mock_calls[0])
def test_check_action_commands_none(): ctx = Mock(side_effect=Exception("failed")) try: input_checks.check_action_command(ctx, None) except Exception: pass # py 3.6: ctx.fail.assert_called() assert 'call.fail(' in str(ctx.mock_calls[0])
def create_action(ctx, action_name, param): check_action_command(ctx, action_name) if not param and action_name is 'redeploy_server': ctx.fail('At least one parameter must be specified using ' '--param="<parameter>" with action redeploy_server') else: param = check_reformat_parameter(ctx, param) click.echo( CreateAction(ctx, action_name, param).invoke_and_return_resp())
def test_check_action_commands(): ctx = mock.Mock(side_effect=Exception("failed")) input_checks.check_action_command(ctx, 'deploy_site') input_checks.check_action_command(ctx, 'update_site') input_checks.check_action_command(ctx, 'update_software') input_checks.check_action_command(ctx, 'redeploy_server') ctx.fail.assert_not_called()