From e9bc4907b76b640f51c4abd0f9b765c4d67544b8 Mon Sep 17 00:00:00 2001 From: reshmabidikar Date: Fri, 6 Sep 2024 16:08:10 +0530 Subject: [PATCH] Run only failing test --- .../core/test_entitlement_cancellation.rb | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 killbill-integration-tests/core/test_entitlement_cancellation.rb diff --git a/killbill-integration-tests/core/test_entitlement_cancellation.rb b/killbill-integration-tests/core/test_entitlement_cancellation.rb new file mode 100644 index 0000000..2299a5d --- /dev/null +++ b/killbill-integration-tests/core/test_entitlement_cancellation.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +$LOAD_PATH.unshift File.expand_path('..', __dir__) + +require 'test_base' + +module KillBillIntegrationTests + class TestEntitlementCancellation < Base + def setup + setup_base + load_default_catalog + @account = create_account(@user, @options) + end + + def teardown + teardown_base + end + + # Cancellation with with explicit no arguments + def test_bp_cancel_default_no_ctd + bp = create_entitlement_base(@account.account_id, 'Sports', 'MONTHLY', 'DEFAULT', @user, @options) + check_entitlement(bp, 'Sports', 'BASE', 'MONTHLY', 'DEFAULT', DEFAULT_KB_INIT_DATE, nil) + + # Cancel BP in trial with no arguments + requested_date = nil + entitlement_policy = nil + billing_policy = nil + use_requested_date_for_billing = nil + bp.cancel(@user, nil, nil, requested_date, entitlement_policy, billing_policy, use_requested_date_for_billing, @options) + + canceled_bp = get_subscription(bp.subscription_id, @options) + check_subscription(canceled_bp, 'Sports', 'BASE', 'MONTHLY', 'DEFAULT', DEFAULT_KB_INIT_DATE, DEFAULT_KB_INIT_DATE, DEFAULT_KB_INIT_DATE, '2013-08-31') + + bp_subscriptions = get_subscriptions(bp.bundle_id, @options) + bp = bp_subscriptions.find { |s| s.subscription_id == bp.subscription_id } + + events = [{ type: 'START_ENTITLEMENT', + date: DEFAULT_KB_INIT_DATE, + billing_period: 'MONTHLY', + product: 'Sports', + plan: 'sports-monthly', + phase: 'sports-monthly-trial', + price_list: 'DEFAULT', + service_name: 'entitlement-service', + service_state_name: 'ENT_STARTED' }, + { type: 'START_BILLING', + date: DEFAULT_KB_INIT_DATE, + billing_period: 'MONTHLY', + product: 'Sports', + plan: 'sports-monthly', + phase: 'sports-monthly-trial', + price_list: 'DEFAULT', + service_name: 'billing-service', + service_state_name: 'START_BILLING' }, + { type: 'STOP_ENTITLEMENT', + date: DEFAULT_KB_INIT_DATE, + service_name: 'entitlement-service', + service_state_name: 'ENT_CANCELLED' }, + { type: 'STOP_BILLING', + date: '2013-08-31', + service_name: 'billing-service', + service_state_name: 'STOP_BILLING' }] + + check_events(events, bp.events) + end + + end +end