Commit 96d0ae36 authored by Skia's avatar Skia
Browse files

subscription: rename test


Signed-off-by: Skia's avatarSkia <skia@libskia.so>
parent 2f912a19
Pipeline #1237 failed with stage
in 6 minutes and 28 seconds
......@@ -102,6 +102,21 @@ class SubscriptionTest(TestCase):
d = Subscription.compute_end(duration=4, start=date(2015, 9, 18))
self.assertTrue(d == date(2017, 9, 18))
@mock.patch('subscription.models.date', FakeDate)
def test_dates_sliding_with_subscribed_user(self):
user = User.objects.filter(pk=self.user.pk).first()
s = Subscription(member=user, subscription_type=list(settings.SITH_SUBSCRIPTIONS.keys())[3],
payment_method=settings.SITH_SUBSCRIPTION_PAYMENT_METHOD[0])
s.subscription_start = date(2015, 8, 29)
s.subscription_end = s.compute_end(duration=2,
start=s.subscription_start)
s.save()
self.assertTrue(s.subscription_end == date(2016, 8, 29))
date_mock_today(2016, 8, 25)
d = Subscription.compute_end(duration=2,
user=user)
self.assertTrue(d == date(2017, 8, 29))
class DecimalDurationTest(TestCase):
def setUp(self):
......@@ -138,23 +153,3 @@ class DecimalDurationTest(TestCase):
s.save()
self.assertTrue(s.subscription_end == date(2017, 12, 29))
class SpecialCasesOfSubscription(TestCase):
def setUp(self):
call_command("populate")
self.user = User.objects.filter(username="public").first()
@mock.patch('subscription.models.date', FakeDate)
def test_subscription_before_end_of_actual_one(self):
user = User.objects.filter(pk=self.user.pk).first()
s = Subscription(member=user, subscription_type=list(settings.SITH_SUBSCRIPTIONS.keys())[3],
payment_method=settings.SITH_SUBSCRIPTION_PAYMENT_METHOD[0])
s.subscription_start = date(2015, 8, 29)
s.subscription_end = s.compute_end(duration=2,
start=s.subscription_start)
s.save()
self.assertTrue(s.subscription_end == date(2016, 8, 29))
date_mock_today(2016, 8, 25)
d = Subscription.compute_end(duration=2,
user=user)
self.assertTrue(d == date(2017, 8, 29))
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