-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8049c8
commit e9bc490
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
killbill-integration-tests/core/test_entitlement_cancellation.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |