1
1

test_internet_mobile.qsrc 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. # test_internet_mobile
  2. !! ------------------------------------------------------------------------------------
  3. !! Location setup
  4. !! ------------------------------------------------------------------------------------
  5. !! @locationsetup
  6. _ISTEST = 1
  7. $LOCATIONNAME = 'internet_mobile'
  8. !! ------------------------------------------------------------------------------------
  9. !! Run the tests that are called below.
  10. !! ------------------------------------------------------------------------------------
  11. !! @run test_subscription_free_value_is_1
  12. !! @run 'test_buy_subscription_day_is_correct'
  13. !! @run 'test_buy_subscription_subscription_is_active'
  14. !! @run 'test_buy_subscription_price_is_correct'
  15. !! @run 'test_buy_subscription_type_is_correct'
  16. !! @run test_cancel_subscription
  17. !! test_buy_subscription_for_invalid_location
  18. !! ------------------------------------------------------------------------------------
  19. !! Tests
  20. !! ------------------------------------------------------------------------------------
  21. !! @tests
  22. if $ARGS[0] = 'test_subscription_free_value_is_1':
  23. $TESTNAME = "Testing that subscription['free'] has a value of 1 on the first call."
  24. $FUNCTIONNAME = ''
  25. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  26. gs 'testframework', 'testsetup'
  27. EXPECTED = 1
  28. $EXPECTED_MESSAGE = "subscription['free'] = <<EXPECTED>>"
  29. gs $LOCATIONNAME, $FUNCTIONNAME
  30. *clr & cla
  31. ACTUAL = subscription['free']
  32. $ACTUAL_MESSAGE = "subscription['free'] = <<ACTUAL>>"
  33. TESTRESULT = EXPECTED = ACTUAL
  34. else
  35. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  36. end
  37. gs 'testframework', 'addTestResult'
  38. gs 'testframework', 'testCleanUpDefault'
  39. killvar 'subscription'
  40. end
  41. if $ARGS[0] = 'test_buy_subscription_day_is_correct':
  42. $TESTNAME = 'Buying subscription sets the renewal day correctly'
  43. $FUNCTIONNAME = 'buy_subscription'
  44. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  45. gs 'testframework', 'testsetup'
  46. EXPECTED = day
  47. $EXPECTED_MESSAGE = "subscription['city_residential-date'] = <<EXPECTED>>"
  48. $ARGUMENTS = "'city_residential', 1200"
  49. gs $LOCATIONNAME, $FUNCTIONNAME, 'city_residential', 1200
  50. *clr & cla
  51. ACTUAL = subscription['city_residential-date']
  52. $ACTUAL_MESSAGE = "subscription['city_residential-date'] = <<ACTUAL>>"
  53. TESTRESULT = EXPECTED = ACTUAL
  54. else
  55. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  56. end
  57. gs 'testframework', 'addTestResult'
  58. gs 'testframework', 'testCleanUpDefault'
  59. killvar 'subscription'
  60. end
  61. if $ARGS[0] = 'test_buy_subscription_subscription_is_active':
  62. $TESTNAME = 'Buying a subscription makes the subscription active'
  63. $FUNCTIONNAME = 'buy_subscription'
  64. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  65. gs 'testframework', 'testsetup'
  66. EXPECTED = 1
  67. $EXPECTED_MESSAGE = "subscription['city_residential'] = <<EXPECTED>>"
  68. $ARGUMENTS = "'city_residential', 1200"
  69. gs $LOCATIONNAME, $FUNCTIONNAME, 'city_residential', 1200
  70. *clr & cla
  71. ACTUAL = subscription['city_residential']
  72. $ACTUAL_MESSAGE = "subscription['city_residential'] = <<ACTUAL>>"
  73. TESTRESULT = EXPECTED = ACTUAL
  74. else
  75. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  76. end
  77. gs 'testframework', 'addTestResult'
  78. gs 'testframework', 'testCleanUpDefault'
  79. killvar 'subscription'
  80. end
  81. if $ARGS[0] = 'test_buy_subscription_price_is_correct':
  82. $TESTNAME = 'Buying a subscription sets the price correctly'
  83. $FUNCTIONNAME = 'buy_subscription'
  84. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  85. gs 'testframework', 'testsetup'
  86. EXPECTED = 1200
  87. $EXPECTED_MESSAGE = "subscription['city_residential-price'] = <<EXPECTED>>"
  88. $ARGUMENTS = "'city_residential', 1200"
  89. gs $LOCATIONNAME, $FUNCTIONNAME, 'city_residential', 1200
  90. *clr & cla
  91. ACTUAL = subscription['city_residential-price']
  92. $ACTUAL_MESSAGE = "subscription['city_residential-price'] = <<ACTUAL>>"
  93. TESTRESULT = EXPECTED = ACTUAL
  94. else
  95. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  96. end
  97. gs 'testframework', 'addTestResult'
  98. gs 'testframework', 'testCleanUpDefault'
  99. killvar 'subscription'
  100. end
  101. if $ARGS[0] = 'test_buy_subscription_type_is_correct':
  102. $TESTNAME = 'Buying a subscription sets the subscription type correctly'
  103. $FUNCTIONNAME = 'buy_subscription'
  104. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  105. gs 'testframework', 'testsetup'
  106. EXPECTED = 1
  107. $EXPECTED_MESSAGE = "subscription['city_residential-type'] = <<EXPECTED>>"
  108. $ARGUMENTS = "'city_residential', 1200"
  109. gs $LOCATIONNAME, $FUNCTIONNAME, 'city_residential', 1200
  110. *clr & cla
  111. ACTUAL = subscription['city_residential-type']
  112. $ACTUAL_MESSAGE = "subscription['city_residential-type'] = <<ACTUAL>>"
  113. TESTRESULT = EXPECTED = ACTUAL
  114. else
  115. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  116. end
  117. gs 'testframework', 'addTestResult'
  118. gs 'testframework', 'testDefaultCleanup'
  119. killvar 'subscription'
  120. end
  121. if $ARGS[0] = 'test_cancel_subscription':
  122. $TESTNAME = 'Cancelling an existing subscription'
  123. $FUNCTIONNAME = 'cancel_subscription'
  124. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  125. gs 'testframework', 'testsetup'
  126. subscription['city_residential'] = 1
  127. subscription['city_residential-date'] = 24
  128. subscription['sms_limit'] = 0
  129. subscription['city_residential-type'] = 1
  130. subscription['city_residential-price'] = 1200
  131. subscription['city_residential-discount'] = 0
  132. EXPECTED = 0
  133. $EXPECTED_MESSAGE = "subscription['city_residential'] = <<EXPECTED>>"
  134. $ARGUMENTS = "'city_residential'"
  135. gs $LOCATIONNAME, $FUNCTIONNAME, 'city_residential'
  136. !! *clr & cla
  137. ACTUAL = subscription['city_residential']
  138. $ACTUAL_MESSAGE = "subscription['city_residential'] = <<ACTUAL>>"
  139. TESTRESULT = EXPECTED = ACTUAL
  140. else
  141. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  142. end
  143. gs 'testframework', 'addTestResult'
  144. gs 'testframework', 'testCleanUpDefault'
  145. killvar 'subscription'
  146. end
  147. killvar 'LOCATIONNAME'
  148. killvar '_ISTEST'
  149. --- test_internet_mobile --------------------------------