from django.contrib.auth.models import User from django.test import TestCase from datetime import timedelta from django.utils import timezone from .models import Event, ActivityTemplate, Activity, Place 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", beginning_date=timezone.now() + timedelta(days=30), ending_date=timezone.now() + timedelta(days=31), ) 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')