Travis correction

This commit is contained in:
Charles-Henri Decultot 2018-06-27 17:10:24 +00:00
parent cde1f08af6
commit 8b3e841fbf

View File

@ -61,7 +61,7 @@ class TestSubscription(unittest.TestCase):
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.trial_period_start = nowdate() subscription.trial_period_start = nowdate()
subscription.trial_period_end = add_days(nowdate(), 30) subscription.trial_period_end = add_days(nowdate(), 30)
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.save() subscription.save()
self.assertEqual(subscription.trial_period_start, nowdate()) self.assertEqual(subscription.trial_period_start, nowdate())
@ -76,7 +76,7 @@ class TestSubscription(unittest.TestCase):
def test_create_subscription_without_trial_with_correct_period(self): def test_create_subscription_without_trial_with_correct_period(self):
subscription = frappe.new_doc('Subscription') subscription = frappe.new_doc('Subscription')
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.save() subscription.save()
self.assertEqual(subscription.trial_period_start, None) self.assertEqual(subscription.trial_period_start, None)
@ -94,7 +94,7 @@ class TestSubscription(unittest.TestCase):
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.trial_period_end = nowdate() subscription.trial_period_end = nowdate()
subscription.trial_period_start = add_days(nowdate(), 30) subscription.trial_period_start = add_days(nowdate(), 30)
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
self.assertRaises(frappe.ValidationError, subscription.save) self.assertRaises(frappe.ValidationError, subscription.save)
subscription.delete() subscription.delete()
@ -104,8 +104,8 @@ class TestSubscription(unittest.TestCase):
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.trial_period_end = nowdate() subscription.trial_period_end = nowdate()
subscription.trial_period_start = add_days(nowdate(), 30) subscription.trial_period_start = add_days(nowdate(), 30)
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.append('plans', {'plan': '_Test Plan Name 3'}) subscription.append('plans', {'plan': '_Test Plan Name 3', 'qty': 1})
self.assertRaises(frappe.ValidationError, subscription.save) self.assertRaises(frappe.ValidationError, subscription.save)
subscription.delete() subscription.delete()
@ -114,7 +114,7 @@ class TestSubscription(unittest.TestCase):
subscription = frappe.new_doc('Subscription') subscription = frappe.new_doc('Subscription')
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.start = '2018-01-01' subscription.start = '2018-01-01'
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.insert() subscription.insert()
self.assertEqual(subscription.status, 'Active') self.assertEqual(subscription.status, 'Active')
@ -130,7 +130,7 @@ class TestSubscription(unittest.TestCase):
def test_status_goes_back_to_active_after_invoice_is_paid(self): def test_status_goes_back_to_active_after_invoice_is_paid(self):
subscription = frappe.new_doc('Subscription') subscription = frappe.new_doc('Subscription')
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.start = '2018-01-01' subscription.start = '2018-01-01'
subscription.insert() subscription.insert()
subscription.process() # generate first invoice subscription.process() # generate first invoice
@ -160,7 +160,7 @@ class TestSubscription(unittest.TestCase):
subscription = frappe.new_doc('Subscription') subscription = frappe.new_doc('Subscription')
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.start = '2018-01-01' subscription.start = '2018-01-01'
subscription.insert() subscription.insert()
subscription.process() # generate first invoice subscription.process() # generate first invoice
@ -183,7 +183,7 @@ class TestSubscription(unittest.TestCase):
subscription = frappe.new_doc('Subscription') subscription = frappe.new_doc('Subscription')
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.start = '2018-01-01' subscription.start = '2018-01-01'
subscription.insert() subscription.insert()
subscription.process() # generate first invoice subscription.process() # generate first invoice
@ -201,7 +201,7 @@ class TestSubscription(unittest.TestCase):
def test_subscription_invoice_days_until_due(self): def test_subscription_invoice_days_until_due(self):
subscription = frappe.new_doc('Subscription') subscription = frappe.new_doc('Subscription')
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.days_until_due = 10 subscription.days_until_due = 10
subscription.start = add_months(nowdate(), -1) subscription.start = add_months(nowdate(), -1)
subscription.insert() subscription.insert()
@ -219,7 +219,7 @@ class TestSubscription(unittest.TestCase):
subscription = frappe.new_doc('Subscription') subscription = frappe.new_doc('Subscription')
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.start = '2018-01-01' subscription.start = '2018-01-01'
subscription.insert() subscription.insert()
subscription.process() # generate first invoice subscription.process() # generate first invoice
@ -243,7 +243,7 @@ class TestSubscription(unittest.TestCase):
def test_subscription_remains_active_during_invoice_period(self): def test_subscription_remains_active_during_invoice_period(self):
subscription = frappe.new_doc('Subscription') subscription = frappe.new_doc('Subscription')
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.save() subscription.save()
subscription.process() # no changes expected subscription.process() # no changes expected
@ -269,7 +269,7 @@ class TestSubscription(unittest.TestCase):
def test_subscription_cancelation(self): def test_subscription_cancelation(self):
subscription = frappe.new_doc('Subscription') subscription = frappe.new_doc('Subscription')
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.save() subscription.save()
subscription.cancel_subscription() subscription.cancel_subscription()
@ -285,7 +285,7 @@ class TestSubscription(unittest.TestCase):
subscription = frappe.new_doc('Subscription') subscription = frappe.new_doc('Subscription')
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.save() subscription.save()
self.assertEqual(subscription.status, 'Active') self.assertEqual(subscription.status, 'Active')
@ -320,7 +320,7 @@ class TestSubscription(unittest.TestCase):
subscription = frappe.new_doc('Subscription') subscription = frappe.new_doc('Subscription')
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.save() subscription.save()
subscription.cancel_subscription() subscription.cancel_subscription()
invoice = subscription.get_current_invoice() invoice = subscription.get_current_invoice()
@ -340,7 +340,7 @@ class TestSubscription(unittest.TestCase):
subscription = frappe.new_doc('Subscription') subscription = frappe.new_doc('Subscription')
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.save() subscription.save()
subscription.cancel_subscription() subscription.cancel_subscription()
@ -364,7 +364,7 @@ class TestSubscription(unittest.TestCase):
subscription = frappe.new_doc('Subscription') subscription = frappe.new_doc('Subscription')
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.start = '2018-01-01' subscription.start = '2018-01-01'
subscription.insert() subscription.insert()
subscription.process() # generate first invoice subscription.process() # generate first invoice
@ -398,7 +398,7 @@ class TestSubscription(unittest.TestCase):
subscription = frappe.new_doc('Subscription') subscription = frappe.new_doc('Subscription')
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.start = '2018-01-01' subscription.start = '2018-01-01'
subscription.insert() subscription.insert()
subscription.process() # generate first invoice subscription.process() # generate first invoice
@ -435,7 +435,7 @@ class TestSubscription(unittest.TestCase):
subscription = frappe.new_doc('Subscription') subscription = frappe.new_doc('Subscription')
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.start = '2018-01-01' subscription.start = '2018-01-01'
subscription.insert() subscription.insert()
subscription.process() # generate first invoice subscription.process() # generate first invoice
@ -463,7 +463,7 @@ class TestSubscription(unittest.TestCase):
def test_restart_active_subscription(self): def test_restart_active_subscription(self):
subscription = frappe.new_doc('Subscription') subscription = frappe.new_doc('Subscription')
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.save() subscription.save()
self.assertRaises(frappe.ValidationError, subscription.restart_subscription) self.assertRaises(frappe.ValidationError, subscription.restart_subscription)
@ -474,7 +474,7 @@ class TestSubscription(unittest.TestCase):
subscription = frappe.new_doc('Subscription') subscription = frappe.new_doc('Subscription')
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.additional_discount_percentage = 10 subscription.additional_discount_percentage = 10
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.save() subscription.save()
subscription.cancel_subscription() subscription.cancel_subscription()
@ -489,7 +489,7 @@ class TestSubscription(unittest.TestCase):
subscription = frappe.new_doc('Subscription') subscription = frappe.new_doc('Subscription')
subscription.subscriber = '_Test Customer' subscription.subscriber = '_Test Customer'
subscription.additional_discount_amount = 11 subscription.additional_discount_amount = 11
subscription.append('plans', {'plan': '_Test Plan Name'}) subscription.append('plans', {'plan': '_Test Plan Name', 'qty': 1})
subscription.save() subscription.save()
subscription.cancel_subscription() subscription.cancel_subscription()