mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 03:49:24 +00:00
sith: Added a new subscription
This commit is contained in:
46
subscription/migrations/0013_auto_20200828_2117.py
Normal file
46
subscription/migrations/0013_auto_20200828_2117.py
Normal file
@ -0,0 +1,46 @@
|
||||
# Generated by Django 2.2.13 on 2020-08-28 19:17
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("subscription", "0012_auto_20200615_1438"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="subscription",
|
||||
name="subscription_type",
|
||||
field=models.CharField(
|
||||
choices=[
|
||||
("amicale/doceo", "Amicale/DOCEO member"),
|
||||
("assidu", "Assidu member"),
|
||||
("benevoles-euroks", "Eurok's volunteer"),
|
||||
("crous", "CROUS member"),
|
||||
("cursus-alternant", "Alternating cursus"),
|
||||
("cursus-alternant-reduction", "Alternating cursus (-20%)"),
|
||||
("cursus-branche", "Branch cursus"),
|
||||
("cursus-branche-reduction", "Branch cursus (-20%)"),
|
||||
("cursus-tronc-commun", "Common core cursus"),
|
||||
("cursus-tronc-commun-reduction", "Common core cursus (-20%)"),
|
||||
("deux-mois-essai", "Two months for free"),
|
||||
("deux-semestres", "Two semesters"),
|
||||
("deux-semestres-reduction", "Two semesters (-20%)"),
|
||||
("membre-honoraire", "Honorary member"),
|
||||
("membre-staff-ga", "GA staff member"),
|
||||
("reseau-ut", "UT network member"),
|
||||
("sbarro/esta", "Sbarro/ESTA member"),
|
||||
("six-semaines-essai", "Six weeks for free"),
|
||||
("un-jour", "One day"),
|
||||
("un-mois-essai", "One month for free"),
|
||||
("un-semestre", "One semester"),
|
||||
("un-semestre-reduction", "One semester (-20%)"),
|
||||
("un-semestre-welcome", "One semester Welcome Week"),
|
||||
],
|
||||
max_length=255,
|
||||
verbose_name="subscription type",
|
||||
),
|
||||
),
|
||||
]
|
@ -114,6 +114,18 @@ class SubscriptionIntegrationTest(TestCase):
|
||||
call_command("populate")
|
||||
self.user = User.objects.filter(username="public").first()
|
||||
|
||||
def test_duration_one_month(self):
|
||||
|
||||
s = Subscription(
|
||||
member=User.objects.filter(pk=self.user.pk).first(),
|
||||
subscription_type=list(settings.SITH_SUBSCRIPTIONS.keys())[3],
|
||||
payment_method=settings.SITH_SUBSCRIPTION_PAYMENT_METHOD[0],
|
||||
)
|
||||
s.subscription_start = date(2017, 8, 29)
|
||||
s.subscription_end = s.compute_end(duration=0.166, start=s.subscription_start)
|
||||
s.save()
|
||||
self.assertTrue(s.subscription_end == date(2017, 9, 29))
|
||||
|
||||
def test_duration_two_months(self):
|
||||
|
||||
s = Subscription(
|
||||
@ -122,11 +134,11 @@ class SubscriptionIntegrationTest(TestCase):
|
||||
payment_method=settings.SITH_SUBSCRIPTION_PAYMENT_METHOD[0],
|
||||
)
|
||||
s.subscription_start = date(2017, 8, 29)
|
||||
s.subscription_end = s.compute_end(duration=0.33, start=s.subscription_start)
|
||||
s.subscription_end = s.compute_end(duration=0.333, start=s.subscription_start)
|
||||
s.save()
|
||||
self.assertTrue(s.subscription_end == date(2017, 10, 29))
|
||||
|
||||
def test_duration_two_months(self):
|
||||
def test_duration_one_day(self):
|
||||
|
||||
s = Subscription(
|
||||
member=User.objects.filter(pk=self.user.pk).first(),
|
||||
|
Reference in New Issue
Block a user