From a52a5d3901614a09b1a3c048f46a800693b2d8e0 Mon Sep 17 00:00:00 2001 From: eloyoussef Date: Fri, 2 Mar 2018 19:37:01 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20du=20test=20autoregistration=20from=20q?= =?UTF-8?q?ueue=20sur=20activit=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/test_golem_activity.py | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/golem_activity_queue/tests/test_golem_activity.py b/golem_activity_queue/tests/test_golem_activity.py index 5cfeb22..cd28876 100644 --- a/golem_activity_queue/tests/test_golem_activity.py +++ b/golem_activity_queue/tests/test_golem_activity.py @@ -102,3 +102,37 @@ class TestGolemActivity(TransactionCase): #verification de l'attente activité self.assertTrue(activity.queue_allowed) self.assertTrue(activity.auto_registration_from_queue) + + #test de basculement automatique depuis queue + def test_auto_registration_from_queue(self): + """ Test auto registration from queue """ + #création de 2 membre est une activité + member1 = self.member1.create(self.data_member_1) + member2 = self.member2.create(self.data_member_2) + activity = self.activity.create(self.data_activity) + #réduire le nombre de place sur activity à 1 et activation de queue et autoregistrement + activity.write({'places': 1, + 'queue_allowed': True, + 'auto_registration_from_queue': True}) + #membre 1 inscrit sur activity + registration = { + 'activity_id' : activity.id, + 'member_id' : member1.id + } + #memebre 2 inscrit sur attente + queue = { + 'activity_id' : activity.id, + 'member_id' : member2.id + } + #enregistrement du membre 1 sur activity et memebre 2 sur attente + activity.write({'activity_registration_ids': [(0, False, registration)]}) + activity.write({'activity_queue_ids': [(0, False, queue)]}) + #vérification du membre 1 sur registration et membre 2 sur attente + self.assertEqual(activity.activity_registration_ids[0].member_id, member1) + self.assertEqual(activity.activity_queue_ids[0].member_id, member2) + #suppression du membre 1 de l'activity + activity.write({'activity_registration_ids': [(2, activity.activity_registration_ids[0].id, False)]}) + #verifcation de la presence du membre 2 sur activity : basculement depuis attente + self.assertEqual(activity.activity_registration_ids[0].member_id, member2) + #verification de l'attente est vide + self.assertFalse(activity.activity_queue_ids)