poulpe/event/tests.py

51 lines
2 KiB
Python
Raw Normal View History

2016-10-02 14:19:38 +02:00
from django.contrib.auth.models import User
from django.test import TestCase
from datetime import timedelta
2016-10-02 14:19:38 +02:00
from django.utils import timezone
from .models import Event, ActivityTemplate, Activity, Place
2016-10-02 14:19:38 +02:00
class ActivityInheritanceTest(TestCase):
@classmethod
def setUpTestData(cls):
cls.erkan = User.objects.create(
username='enarmanli',
email='erkan.narmanli@ens.fr',
first_name='Erkan',
last_name='Narmanli',
)
cls.event = Event.objects.create(
title='La Nuit 2042',
slug='nuit42',
created_by=cls.erkan,
creation_date=timezone.now(),
description="La nuit c'est lol",
2016-10-02 14:19:38 +02:00
beginning_date=timezone.now()
+ timedelta(days=30),
2016-10-02 14:19:38 +02:00
ending_date=timezone.now()
+ timedelta(days=31),
2016-10-02 14:19:38 +02:00
)
cls.loge = Place.objects.create(name="Loge 45")
cls.permtemp = ActivityTemplate.objects.create(
title="Permanence loge",
# is_public non spécifié
has_perm=False,
description="Les perms c'est lol",
# remark non spécifié
)
cls.permtemp.place.add(cls.loge)
cls.perm = Activity.objects.create(
parent=cls.permtemp,
# title non spécifié
is_public=True,
# has_perm non spécifié
# description non spécifiée
remarks="lol",
)
def test_event_name(self):
self.assertEqual(self.event.title, 'La Nuit 2042')
self.assertEqual(self.loge.name, 'Loge 45')
self.assertEqual(self.permtemp.title, 'Permanence loge')
self.assertEqual(self.permtemp.place.name, 'Loge 45')