Commit c8c036f3 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_subscription_request: Update default Price

parent 1bbea36a
Pipeline #15358 passed with stage
in 0 seconds
......@@ -25,19 +25,19 @@ class TestSlapOSSubscriptionCDNScenarioMixin(TestSlapOSSubscriptionScenarioMixin
def afterSetUp(self):
TestSlapOSSubscriptionScenarioMixin.afterSetUp(self)
self.expected_individual_price_without_tax = 4.16666666667
self.expected_individual_price_with_tax = 5.0
self.expected_reservation_fee = 1.0
self.expected_reservation_fee_without_tax = 0.833333333333333
self.expected_reservation_quantity_tax = 0.833333333333333
self.expected_reservation_tax = 0.166666666666667
self.expected_individual_price_without_tax = 5
self.expected_individual_price_with_tax = 6.0
self.expected_reservation_fee = 1.2
self.expected_reservation_fee_without_tax = 1
self.expected_reservation_quantity_tax = 1.0
self.expected_reservation_tax = 0.2
self.expected_price_currency = "currency_module/EUR"
self.expected_zh_individual_price_without_tax = 40
self.expected_zh_individual_price_with_tax = 40.4
self.expected_zh_reservation_fee = 8.08
self.expected_zh_reservation_fee_without_tax = 8.0
self.expected_zh_reservation_quantity_tax = 8.08
self.expected_zh_reservation_quantity_tax = 8.0
self.expected_zh_reservation_tax = 0.08
self.resource_variation_reference = "CDN"
......
......@@ -31,12 +31,12 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
def afterSetUp(self):
self.unpinDateTime()
self.normal_user = None
self.expected_individual_price_without_tax = 162.50
self.expected_individual_price_with_tax = 195.00
self.expected_reservation_fee = 25.00
self.expected_reservation_fee_without_tax = 20.833333333333333
self.expected_reservation_quantity_tax = 20.833333333333333
self.expected_reservation_tax = 4.166666666666667
self.expected_individual_price_without_tax = 195
self.expected_individual_price_with_tax = 234
self.expected_reservation_fee = 30.00
self.expected_reservation_fee_without_tax = 25
self.expected_reservation_quantity_tax = 25
self.expected_reservation_tax = 5.0
self.expected_price_currency = "currency_module/EUR"
......@@ -412,7 +412,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
self.assertEqual(payment.getSourcePayment(),
"%s/bank_account" % expected_source_section)
self.assertEqual(int(payment.PaymentTransaction_getTotalPayablePrice()*100),
self.assertEqual(int(round(payment.PaymentTransaction_getTotalPayablePrice(), 2)*100),
-authAmount)
self.assertEqual(payment.getPriceCurrency(),
......@@ -601,8 +601,8 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
# Pay with appropriate mode depending of the currency.
if payment.getPriceCurrency() == "currency_module/CNY":
self.assertEqual(-self.expected_zh_reservation_fee*quantity,
payment.PaymentTransaction_getTotalPayablePrice())
self.assertEqual(-round(self.expected_zh_reservation_fee*quantity, 2),
round(payment.PaymentTransaction_getTotalPayablePrice(), 2))
# Pay 188 CNY per VM
data_kw = {
......@@ -615,8 +615,8 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
# Wechat_processUpdate will mark payment as payed by stopping it.
payment.PaymentTransaction_createWechatEvent().WechatEvent_processUpdate(data_kw)
else:
self.assertEqual(-self.expected_reservation_fee*quantity,
payment.PaymentTransaction_getTotalPayablePrice())
self.assertEqual(-round(self.expected_reservation_fee*quantity, 2),
round(payment.PaymentTransaction_getTotalPayablePrice(), 2))
# Pay 25 euros per VM
data_kw = {
......@@ -734,7 +734,8 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
self.assertEqual(round(line.getTotalPrice(), 2),
round(expected_reservation_tax*quantity, 2))
self.assertEqual(round(invoice.getTotalPrice(), 2), expected_reservation_fee*quantity)
self.assertEqual(round(invoice.getTotalPrice(), 2),
round(expected_reservation_fee*quantity, 2))
def checkSecondMonthAggregatedSalePackingList(self, subscription_request, sale_packing_list):
sale_packing_list_line = [ i for i in sale_packing_list.objectValues()
......
......@@ -488,9 +488,9 @@ class TestSubscriptionRequest_requestPaymentTransaction(TestSubscriptionSkinsMix
for line in current_payment.contentValues():
if line.getSource() == "account_module/payment_to_encash":
self.assertEqual(line.getQuantity(), -25*quantity)
self.assertEqual(line.getQuantity(), -30*quantity)
if line.getSource() == "account_module/receivable":
self.assertEqual(line.getQuantity(), 25*quantity)
self.assertEqual(line.getQuantity(), 30*quantity)
def _test_request_payment_transaction_chinese(self, quantity):
email = "abc%s@nexedi.com" % self.new_id
......@@ -518,13 +518,13 @@ class TestSubscriptionRequest_requestPaymentTransaction(TestSubscriptionSkinsMix
for line in current_payment.contentValues():
if line.getSource() == "account_module/payment_to_encash":
self.assertEqual(line.getQuantity(), -188*quantity)
self.assertEqual(line.getQuantity(), -189.88*quantity)
if line.getSource() == "account_module/receivable":
self.assertEqual(line.getQuantity(), 188*quantity)
self.assertEqual(line.getQuantity(), 189.88*quantity)
@simulate('SubscriptionRequest_createRelatedSaleInvoiceTransaction', 'price, tag, payment, template, REQUEST=None',"""assert REQUEST == None
assert payment
assert price == 20.8333333
assert price == 25.0
assert tag == 'TAG'
assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate()""")
def test_request_payment_transaction_q1(self):
......@@ -532,7 +532,7 @@ assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubsc
@simulate('SubscriptionRequest_createRelatedSaleInvoiceTransaction', 'price, tag, payment, template, REQUEST=None',"""assert REQUEST == None
assert payment
assert price == 20.8333333
assert price == 25.0
assert tag == 'TAG'
assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate()""")
def test_request_payment_transaction_q2(self):
......@@ -540,7 +540,7 @@ assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubsc
@simulate('SubscriptionRequest_createRelatedSaleInvoiceTransaction', 'price, tag, payment, template, REQUEST=None',"""assert REQUEST == None
assert payment
assert price == 20.8333333
assert price == 25.0
assert tag == 'TAG'
assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate()""")
def test_request_payment_transaction_q10(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment