123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- !! ------------------------------------------------------------------------------------
- !! Location setup
- !! ------------------------------------------------------------------------------------
- !! @locationsetup
- _ISTEST = 1
- $LOCATIONNAME = 'internet_mobile'
- !! ------------------------------------------------------------------------------------
- !! Run the tests that are called below.
- !! ------------------------------------------------------------------------------------
- !! @run test_subscription_free_value_is_1
- !! @run 'test_buy_subscription_day_is_correct'
- !! @run 'test_buy_subscription_subscription_is_active'
- !! @run 'test_buy_subscription_price_is_correct'
- !! @run 'test_buy_subscription_type_is_correct'
- !! @run test_cancel_subscription
- !! test_buy_subscription_for_invalid_location
- !! ------------------------------------------------------------------------------------
- !! Tests
- !! ------------------------------------------------------------------------------------
- !! @tests
- if $ARGS[0] = 'test_subscription_free_value_is_1':
- $TESTNAME = "Testing that subscription['free'] has a value of 1 on the first call."
- $FUNCTIONNAME = ''
- if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
- gs 'testframework', 'testsetup'
-
- EXPECTED = 1
- $EXPECTED_MESSAGE = "subscription['free'] = <<EXPECTED>>"
-
- gs $LOCATIONNAME, $FUNCTIONNAME
- *clr & cla
-
- ACTUAL = subscription['free']
- $ACTUAL_MESSAGE = "subscription['free'] = <<ACTUAL>>"
- TESTRESULT = EXPECTED = ACTUAL
-
- else
- $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
- end
- gs 'testframework', 'addTestResult'
- gs 'testframework', 'testCleanUpDefault'
- killvar 'subscription'
- end
- if $ARGS[0] = 'test_buy_subscription_day_is_correct':
- $TESTNAME = 'Buying subscription sets the renewal day correctly'
- $FUNCTIONNAME = 'buy_subscription'
- if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
- gs 'testframework', 'testsetup'
- EXPECTED = day
- $EXPECTED_MESSAGE = "subscription['city_residential-date'] = <<EXPECTED>>"
-
- $ARGUMENTS = "'city_residential', 1200"
- gs $LOCATIONNAME, $FUNCTIONNAME, 'city_residential', 1200
- *clr & cla
- ACTUAL = subscription['city_residential-date']
- $ACTUAL_MESSAGE = "subscription['city_residential-date'] = <<ACTUAL>>"
- TESTRESULT = EXPECTED = ACTUAL
- else
- $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
- end
- gs 'testframework', 'addTestResult'
- gs 'testframework', 'testCleanUpDefault'
- killvar 'subscription'
- end
- if $ARGS[0] = 'test_buy_subscription_subscription_is_active':
- $TESTNAME = 'Buying a subscription makes the subscription active'
- $FUNCTIONNAME = 'buy_subscription'
- if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
- gs 'testframework', 'testsetup'
- EXPECTED = 1
- $EXPECTED_MESSAGE = "subscription['city_residential'] = <<EXPECTED>>"
-
- $ARGUMENTS = "'city_residential', 1200"
- gs $LOCATIONNAME, $FUNCTIONNAME, 'city_residential', 1200
- *clr & cla
- ACTUAL = subscription['city_residential']
- $ACTUAL_MESSAGE = "subscription['city_residential'] = <<ACTUAL>>"
- TESTRESULT = EXPECTED = ACTUAL
- else
- $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
- end
- gs 'testframework', 'addTestResult'
- gs 'testframework', 'testCleanUpDefault'
- killvar 'subscription'
- end
- if $ARGS[0] = 'test_buy_subscription_price_is_correct':
- $TESTNAME = 'Buying a subscription sets the price correctly'
- $FUNCTIONNAME = 'buy_subscription'
- if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
- gs 'testframework', 'testsetup'
- EXPECTED = 1200
- $EXPECTED_MESSAGE = "subscription['city_residential-price'] = <<EXPECTED>>"
-
- $ARGUMENTS = "'city_residential', 1200"
- gs $LOCATIONNAME, $FUNCTIONNAME, 'city_residential', 1200
- *clr & cla
- ACTUAL = subscription['city_residential-price']
- $ACTUAL_MESSAGE = "subscription['city_residential-price'] = <<ACTUAL>>"
- TESTRESULT = EXPECTED = ACTUAL
- else
- $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
- end
- gs 'testframework', 'addTestResult'
- gs 'testframework', 'testCleanUpDefault'
- killvar 'subscription'
- end
- if $ARGS[0] = 'test_buy_subscription_type_is_correct':
- $TESTNAME = 'Buying a subscription sets the subscription type correctly'
- $FUNCTIONNAME = 'buy_subscription'
- if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
- gs 'testframework', 'testsetup'
- EXPECTED = 1
- $EXPECTED_MESSAGE = "subscription['city_residential-type'] = <<EXPECTED>>"
-
- $ARGUMENTS = "'city_residential', 1200"
- gs $LOCATIONNAME, $FUNCTIONNAME, 'city_residential', 1200
- *clr & cla
- ACTUAL = subscription['city_residential-type']
- $ACTUAL_MESSAGE = "subscription['city_residential-type'] = <<ACTUAL>>"
- TESTRESULT = EXPECTED = ACTUAL
- else
- $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
- end
- gs 'testframework', 'addTestResult'
- gs 'testframework', 'testDefaultCleanup'
- killvar 'subscription'
- end
- if $ARGS[0] = 'test_cancel_subscription':
- $TESTNAME = 'Cancelling an existing subscription'
- $FUNCTIONNAME = 'cancel_subscription'
-
- if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
- gs 'testframework', 'testsetup'
-
- subscription['city_residential'] = 1
- subscription['city_residential-date'] = 24
- subscription['sms_limit'] = 0
- subscription['city_residential-type'] = 1
- subscription['city_residential-price'] = 1200
- subscription['city_residential-discount'] = 0
- EXPECTED = 0
- $EXPECTED_MESSAGE = "subscription['city_residential'] = <<EXPECTED>>"
- $ARGUMENTS = "'city_residential'"
- gs $LOCATIONNAME, $FUNCTIONNAME, 'city_residential'
- !! *clr & cla
- ACTUAL = subscription['city_residential']
- $ACTUAL_MESSAGE = "subscription['city_residential'] = <<ACTUAL>>"
-
- TESTRESULT = EXPECTED = ACTUAL
-
- else
- $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
- end
-
- gs 'testframework', 'addTestResult'
- gs 'testframework', 'testCleanUpDefault'
- killvar 'subscription'
- end
- killvar 'LOCATIONNAME'
- killvar '_ISTEST'
- --- test_internet_mobile --------------------------------
|