From 0a99877589854b8ddecc25242120f2d5ceac7edf Mon Sep 17 00:00:00 2001 From: eloyoussef Date: Mon, 5 Mar 2018 12:18:37 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20du=20test=20d'inscription=20en=20attent?= =?UTF-8?q?e=20=C3=A0=20travers=20l'assistant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/test_golem_member.py | 27 +++++++++++++++++++ .../wizard/golem_activity_queue_choose.py | 10 +------ 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/golem_activity_queue/tests/test_golem_member.py b/golem_activity_queue/tests/test_golem_member.py index 90e9b91..b2c3f46 100644 --- a/golem_activity_queue/tests/test_golem_member.py +++ b/golem_activity_queue/tests/test_golem_member.py @@ -94,3 +94,30 @@ class TestGolemMember(TransactionCase): self.assertEqual(activity.activity_registration_ids[0].member_id, member2) #verification de l'attente est vide self.assertFalse(activity.activity_queue_ids) + + def test_choose_queue_to_register(self): + """ Queue register through wizard """ + + #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) + #membre 1 inscrit sur activity + registration = { + 'activity_id' : activity.id, + 'member_id' : member1.id + } + #réduire le nombre de place sur activity à 1 + activity.write({'places': 1}) + #enregistrement du membre 1 sur activity et memebre 2 sur attente + activity.write({'activity_registration_ids': [(0, False, registration)]}) + #enregistrement du membre 2 a travers l'assistant + queue_register_wizard = self.env['golem.activity.queue.choose.wizard'].create({ + 'activity_id': activity.id, + 'member_id': member2.id + }) + queue_register_wizard.register_in_queue() + + #verifcation de l'inscription en queue + self.assertEqual(activity.activity_queue_ids[0].member_id, member2) + self.assertEqual(member2.activity_queue_ids[0].activity_id, activity) diff --git a/golem_activity_queue/wizard/golem_activity_queue_choose.py b/golem_activity_queue/wizard/golem_activity_queue_choose.py index e3f79bb..c30aacb 100644 --- a/golem_activity_queue/wizard/golem_activity_queue_choose.py +++ b/golem_activity_queue/wizard/golem_activity_queue_choose.py @@ -18,7 +18,7 @@ """ GOLEM Resources management """ -from odoo import models, fields, _ +from odoo import models, fields class GolemActivityQueueChooseWizard(models.TransientModel): """GOLEM Resource wizard : rchoose activity queue to register in """ @@ -35,11 +35,3 @@ class GolemActivityQueueChooseWizard(models.TransientModel): activity_queue = self[0] self.env['golem.activity.queue'].create({'member_id': activity_queue.member_id.id, 'activity_id': activity_queue.activity_id.id}) - message = _('the member {} is registred in queue for the activity {} with success') - return { - 'warning' : { - 'title' : _('Warning'), - 'message': (message.format(activity_queue.member_id.name, - activity_queue.activity_id.name)) - } - }