[REF]GOLEM Activity Queue : huge refactoring for tests
This commit is contained in:
parent
22fbbe4d11
commit
21e7ed9b5c
@ -20,7 +20,7 @@
|
|||||||
'name': 'GOLEM activity queues',
|
'name': 'GOLEM activity queues',
|
||||||
'summary': 'GOLEM activity queues',
|
'summary': 'GOLEM activity queues',
|
||||||
'description': ''' GOLEM activity queue management ''',
|
'description': ''' GOLEM activity queue management ''',
|
||||||
'version': '10.0.1.2.1',
|
'version': '10.0.1.2.2',
|
||||||
'category': 'GOLEM',
|
'category': 'GOLEM',
|
||||||
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
|
@ -27,31 +27,26 @@ class TestGolemActivity(TransactionCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
""" Bootstrap activity """
|
""" Bootstrap activity """
|
||||||
super(TestGolemActivity, self).setUp()
|
super(TestGolemActivity, self).setUp()
|
||||||
#création du saison
|
self.season = self.env['golem.season'].create({'name': u'Season 1'})
|
||||||
self.season = self.env['golem.season'].sudo().create({'name': u'Season 1'})
|
|
||||||
self.season.do_default_season()
|
|
||||||
#préparation des données pour la création des membres
|
|
||||||
self.data_member_1 = {'lastname': u'LAST1',
|
self.data_member_1 = {'lastname': u'LAST1',
|
||||||
'firstname': u'First1',
|
'firstname': u'First1',
|
||||||
'season_ids':[(4, self.season.id, False)]
|
'season_ids':[(4, self.season.id, False)]}
|
||||||
}
|
|
||||||
self.data_member_2 = {'lastname': u'LAST2',
|
self.data_member_2 = {'lastname': u'LAST2',
|
||||||
'firstname': u'First2',
|
'firstname': u'First2',
|
||||||
'season_ids':[(4, self.season.id, False)]
|
'season_ids':[(4, self.season.id, False)]}
|
||||||
}
|
self.member = self.env['golem.member']
|
||||||
self.member1 = self.env['golem.member']
|
type_id = self.env.ref('golem_activity.golem_activity_type_activity')
|
||||||
self.member2 = self.env['golem.member']
|
|
||||||
#préparation des donnée pour la création de l'activité
|
|
||||||
type_id = self.ref("golem_activity.golem_activity_type_activity")
|
|
||||||
self.data_activity = {
|
self.data_activity = {
|
||||||
'name': u'Activity 1',
|
'name': u'Activity 1',
|
||||||
'season_id': self.season.id,
|
'season_id': self.season.id,
|
||||||
'type_id': type_id}
|
'type_id': type_id.id
|
||||||
|
}
|
||||||
self.activity = self.env['golem.activity']
|
self.activity = self.env['golem.activity']
|
||||||
|
self.activity_registration = self.env['golem.activity.registration']
|
||||||
|
self.activity_queue = self.env['golem.activity.queue']
|
||||||
|
|
||||||
# test de creation d'activity et inistialisation des champs
|
|
||||||
def test_activity_creation(self):
|
def test_activity_creation(self):
|
||||||
""" Test creation of activity """
|
""" Test activity defaults for queue """
|
||||||
activity = self.activity.create(self.data_activity)
|
activity = self.activity.create(self.data_activity)
|
||||||
self.assertTrue(activity.queue_allowed)
|
self.assertTrue(activity.queue_allowed)
|
||||||
self.assertTrue(activity.auto_registration_from_queue)
|
self.assertTrue(activity.auto_registration_from_queue)
|
||||||
@ -59,8 +54,6 @@ class TestGolemActivity(TransactionCase):
|
|||||||
self.assertFalse(activity.activity_registration_ids)
|
self.assertFalse(activity.activity_registration_ids)
|
||||||
self.assertFalse(activity.activity_queue_ids)
|
self.assertFalse(activity.activity_queue_ids)
|
||||||
|
|
||||||
|
|
||||||
#test toggle auto_registration
|
|
||||||
def test_auto_registration_toggle(self):
|
def test_auto_registration_toggle(self):
|
||||||
""" Test Toggle Autoregistration from queue """
|
""" Test Toggle Autoregistration from queue """
|
||||||
activity = self.activity.create(self.data_activity)
|
activity = self.activity.create(self.data_activity)
|
||||||
@ -69,112 +62,73 @@ class TestGolemActivity(TransactionCase):
|
|||||||
self.assertFalse(activity.auto_registration_from_queue)
|
self.assertFalse(activity.auto_registration_from_queue)
|
||||||
activity.auto_registration_toggle()
|
activity.auto_registration_toggle()
|
||||||
self.assertTrue(activity.auto_registration_from_queue)
|
self.assertTrue(activity.auto_registration_from_queue)
|
||||||
#test du queue_allowed toggle: en cas de désactivation queue doit etre vidé
|
|
||||||
def test_queue_allowed_toggle(self):
|
def test_queue_allowed_toggle(self):
|
||||||
""" Test Toggle queue_allowed """
|
""" Test Toggle queue_allowed """
|
||||||
#création de 2 membre est une activité
|
#création de 2 membre est une activité
|
||||||
member1 = self.member1.create(self.data_member_1)
|
member1 = self.member.create(self.data_member_1)
|
||||||
member2 = self.member2.create(self.data_member_2)
|
member2 = self.member.create(self.data_member_2)
|
||||||
activity = self.activity.create(self.data_activity)
|
activity = self.activity.create(self.data_activity)
|
||||||
#membre 1 inscrit sur activity
|
registration_data = {'activity_id' : activity.id, 'member_id' : member1.id}
|
||||||
registration = {
|
queue_data = {'activity_id' : activity.id, 'member_id' : member2.id}
|
||||||
'activity_id' : activity.id,
|
|
||||||
'member_id' : member1.id
|
|
||||||
}
|
|
||||||
#memebre 2 inscrit sur attente
|
|
||||||
queue = {
|
|
||||||
'activity_id' : activity.id,
|
|
||||||
'member_id' : member2.id
|
|
||||||
}
|
|
||||||
#Verification que l'atente est aactivé
|
|
||||||
self.assertTrue(activity.queue_allowed)
|
self.assertTrue(activity.queue_allowed)
|
||||||
#réduire le nombre de place sur activity à 1
|
activity.places = 1
|
||||||
activity.write({'places': 1})
|
self.activity_registration.create(registration_data)
|
||||||
#enregistrement du membre 1 sur activity et memebre 2 sur attente
|
self.activity_queue.create(queue_data)
|
||||||
activity.write({'activity_registration_ids': [(0, False, registration)]})
|
|
||||||
activity.write({'activity_queue_ids': [(0, False, queue)]})
|
self.assertTrue(activity.auto_registration_from_queue)
|
||||||
#desactivation de l'attente
|
|
||||||
activity.queue_allowed_toggle()
|
activity.queue_allowed_toggle()
|
||||||
#verification que l'attente est désactivé et vidé
|
|
||||||
self.assertFalse(activity.queue_allowed)
|
self.assertFalse(activity.queue_allowed)
|
||||||
self.assertFalse(activity.activity_queue_ids)
|
self.assertFalse(activity.activity_queue_ids)
|
||||||
#appel wizard pour activation de l'attente
|
|
||||||
queue_activate_wizard_model = self.env['golem.activity.automated.queue.activate.wizard']
|
queue_activate_wizard_model = self.env['golem.activity.automated.queue.activate.wizard']
|
||||||
queue_activate_wizard = queue_activate_wizard_model.create({'activity_id': activity.id})
|
queue_activate_wizard = queue_activate_wizard_model.create({'activity_id': activity.id})
|
||||||
queue_activate_wizard.activate_queue()
|
queue_activate_wizard.activate_queue()
|
||||||
#verification de l'attente activité
|
|
||||||
self.assertTrue(activity.queue_allowed)
|
self.assertTrue(activity.queue_allowed)
|
||||||
self.assertTrue(activity.auto_registration_from_queue)
|
self.assertTrue(activity.auto_registration_from_queue)
|
||||||
|
|
||||||
#test de basculement automatique depuis queue
|
|
||||||
def test_auto_registration(self):
|
def test_auto_registration(self):
|
||||||
""" Test auto registration from queue """
|
""" Test auto registration from queue """
|
||||||
#création de 2 membre est une activité
|
member1 = self.member.create(self.data_member_1)
|
||||||
member1 = self.member1.create(self.data_member_1)
|
member2 = self.member.create(self.data_member_2)
|
||||||
member2 = self.member2.create(self.data_member_2)
|
|
||||||
activity = self.activity.create(self.data_activity)
|
activity = self.activity.create(self.data_activity)
|
||||||
#réduire le nombre de place sur activity à 1 et activation de queue et autoregistrement
|
self.assertTrue(activity.queue_allowed)
|
||||||
activity.write({'places': 1,
|
self.assertTrue(activity.auto_registration_from_queue)
|
||||||
'queue_allowed': True,
|
|
||||||
'auto_registration_from_queue': True})
|
registration_data = {'activity_id' : activity.id, 'member_id' : member1.id}
|
||||||
#membre 1 inscrit sur activity
|
queue_data = {'activity_id' : activity.id, 'member_id' : member2.id}
|
||||||
registration = {
|
|
||||||
'activity_id' : activity.id,
|
activity.places = 1
|
||||||
'member_id' : member1.id
|
registration = self.activity_registration.create(registration_data)
|
||||||
}
|
self.activity_queue.create(queue_data)
|
||||||
#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_registration_ids[0].member_id, member1)
|
||||||
self.assertEqual(activity.activity_queue_ids[0].member_id, member2)
|
self.assertEqual(activity.activity_queue_ids[0].member_id, member2)
|
||||||
#suppression du membre 1 de l'activity
|
|
||||||
activity.write({'activity_registration_ids': [(2,
|
registration.unlink()
|
||||||
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)
|
self.assertEqual(activity.activity_registration_ids[0].member_id, member2)
|
||||||
#verification de l'attente est vide
|
|
||||||
self.assertFalse(activity.activity_queue_ids)
|
self.assertFalse(activity.activity_queue_ids)
|
||||||
# suppression du membre sur l'attente s'il sinscrit directement sur l'activity
|
|
||||||
def test_delete_queue_member(self):
|
def test_delete_queue_member(self):
|
||||||
""" Test Delete Queue member if they directly register """
|
""" Test Delete Queue member if they directly register """
|
||||||
#création de 2 membre est une activité
|
member1 = self.member.create(self.data_member_1)
|
||||||
member1 = self.member1.create(self.data_member_1)
|
member2 = self.member.create(self.data_member_2)
|
||||||
member2 = self.member2.create(self.data_member_2)
|
|
||||||
activity = self.activity.create(self.data_activity)
|
activity = self.activity.create(self.data_activity)
|
||||||
#réduire le nombre de place sur activity à 1 et activation de queue et autoregistrement
|
self.assertTrue(activity.queue_allowed)
|
||||||
activity.write({'places': 1,
|
self.assertTrue(activity.auto_registration_from_queue)
|
||||||
'queue_allowed': True,
|
activity.auto_registration_toggle()
|
||||||
'auto_registration_from_queue': False})
|
self.assertFalse(activity.auto_registration_from_queue)
|
||||||
#membre 1 inscrit sur activity
|
|
||||||
registration = {
|
registration_data = {'activity_id' : activity.id, 'member_id' : member1.id}
|
||||||
'activity_id' : activity.id,
|
queue_data = {'activity_id' : activity.id, 'member_id' : member2.id}
|
||||||
'member_id' : member1.id
|
|
||||||
}
|
activity.places = 1
|
||||||
#memebre 2 inscrit sur attente
|
registration = self.activity_registration.create(registration_data)
|
||||||
queue = {
|
self.activity_queue.create(queue_data)
|
||||||
'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 des inscriptions
|
|
||||||
self.assertEqual(activity.activity_registration_ids[0].member_id, member1)
|
self.assertEqual(activity.activity_registration_ids[0].member_id, member1)
|
||||||
self.assertEqual(activity.activity_queue_ids[0].member_id, member2)
|
self.assertEqual(activity.activity_queue_ids[0].member_id, member2)
|
||||||
#suppression du membre 1 de l'activity
|
registration.unlink()
|
||||||
activity.write({'activity_registration_ids': [(2,
|
|
||||||
activity.activity_registration_ids[0].id,
|
activity.activity_registration_ids = [(0, False, queue_data)]
|
||||||
False)]})
|
|
||||||
#inscription sur activity avec le membre sur queue
|
|
||||||
activity.write({'activity_registration_ids': [(0, False, queue)]})
|
|
||||||
#vérification queue vide
|
|
||||||
self.assertFalse(activity.activity_queue_ids)
|
self.assertFalse(activity.activity_queue_ids)
|
||||||
#verification du membre 2 sur inscriptions
|
|
||||||
self.assertEqual(activity.activity_registration_ids[0].member_id, member2)
|
self.assertEqual(activity.activity_registration_ids[0].member_id, member2)
|
||||||
|
@ -29,31 +29,27 @@ class TestGolemActivityQueue(TransactionCase):
|
|||||||
""" Bootstrap ActivityQueue """
|
""" Bootstrap ActivityQueue """
|
||||||
super(TestGolemActivityQueue, self).setUp(*args, **kwargs)
|
super(TestGolemActivityQueue, self).setUp(*args, **kwargs)
|
||||||
|
|
||||||
self.season = self.env['golem.season'].sudo().create({'name': u'Season 1'})
|
self.season = self.env['golem.season'].create({'name': u'Season 1'})
|
||||||
self.season.do_default_season()
|
|
||||||
#préparation des données pour la création des membres
|
|
||||||
self.data_member_1 = {'lastname': u'LAST1',
|
self.data_member_1 = {'lastname': u'LAST1',
|
||||||
'firstname': u'First1',
|
'firstname': u'First1',
|
||||||
'season_ids':[(4, self.season.id, False)]
|
'season_ids':[(4, self.season.id, False)]}
|
||||||
}
|
|
||||||
self.data_member_2 = {'lastname': u'LAST2',
|
self.data_member_2 = {'lastname': u'LAST2',
|
||||||
'firstname': u'First2',
|
'firstname': u'First2',
|
||||||
'season_ids':[(4, self.season.id, False)]
|
'season_ids':[(4, self.season.id, False)]}
|
||||||
}
|
self.member = self.env['golem.member']
|
||||||
self.member1 = self.env['golem.member']
|
type_id = self.env.ref('golem_activity.golem_activity_type_activity')
|
||||||
self.member2 = self.env['golem.member']
|
|
||||||
#préparation des donnée pour la création de l'activité
|
|
||||||
type_id = self.ref("golem_activity.golem_activity_type_activity")
|
|
||||||
self.data_activity = {
|
self.data_activity = {
|
||||||
'name': u'Activity 1',
|
'name': u'Activity 1',
|
||||||
'season_id': self.season.id,
|
'season_id': self.season.id,
|
||||||
'type_id': type_id}
|
'type_id': type_id.id
|
||||||
|
}
|
||||||
self.activity = self.env['golem.activity']
|
self.activity = self.env['golem.activity']
|
||||||
self.activity_queue = self.env['golem.activity.queue']
|
self.activity_queue = self.env['golem.activity.queue']
|
||||||
|
self.activity_registration = self.env['golem.activity.registration']
|
||||||
|
|
||||||
def test_activity_queue_basic(self):
|
def test_activity_queue_basic(self):
|
||||||
""" Test activity queue bases """
|
""" Test activity queue basics """
|
||||||
member1 = self.member1.create(self.data_member_1)
|
member1 = self.member.create(self.data_member_1)
|
||||||
activity = self.activity.create(self.data_activity)
|
activity = self.activity.create(self.data_activity)
|
||||||
activity.auto_registration_from_queue = False
|
activity.auto_registration_from_queue = False
|
||||||
activity_queue = self.activity_queue.create({'activity_id': activity.id,
|
activity_queue = self.activity_queue.create({'activity_id': activity.id,
|
||||||
@ -61,18 +57,14 @@ class TestGolemActivityQueue(TransactionCase):
|
|||||||
self.assertEqual(activity.activity_queue_ids[0], activity_queue)
|
self.assertEqual(activity.activity_queue_ids[0], activity_queue)
|
||||||
self.assertEqual(member1.activity_queue_ids[0], activity_queue)
|
self.assertEqual(member1.activity_queue_ids[0], activity_queue)
|
||||||
|
|
||||||
#test interdiction d'inscrire sur attente si inscrit sur activité
|
|
||||||
def test_check_member_registration(self):
|
def test_check_member_registration(self):
|
||||||
""" Test activity queue bases """
|
""" Test activity queue fordib if already in activity """
|
||||||
#creation du membre et de l'activité
|
member1 = self.member.create(self.data_member_1)
|
||||||
member1 = self.member1.create(self.data_member_1)
|
|
||||||
activity = self.activity.create(self.data_activity)
|
activity = self.activity.create(self.data_activity)
|
||||||
#enregistrement du membre 1 sur activity
|
self.activity_registration.create({'activity_id': activity.id,
|
||||||
activity.write({'activity_registration_ids': [(0, False, {'activity_id': activity.id,
|
'member_id': member1.id})
|
||||||
'member_id': member1.id})]})
|
|
||||||
#vérification que le membre 1 est inscrit sur activité
|
|
||||||
self.assertEqual(activity.activity_registration_ids[0].member_id, member1)
|
self.assertEqual(activity.activity_registration_ids[0].member_id, member1)
|
||||||
#inscription du meme membre sur l'attente du meme activié: interdit
|
with self.assertRaises(ValidationError) as err:
|
||||||
with self.assertRaises(ValidationError):
|
|
||||||
self.activity_queue.create({'activity_id': activity.id,
|
self.activity_queue.create({'activity_id': activity.id,
|
||||||
'member_id': member1.id})
|
'member_id': member1.id})
|
||||||
|
self.assertIn('already registered for this activity', err.exception.args[0])
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
""" GOLEM Member testing """
|
""" GOLEM Member testing """
|
||||||
|
|
||||||
from odoo.tests.common import TransactionCase
|
from odoo.tests.common import TransactionCase
|
||||||
# from psycopg2 import IntegrityError
|
|
||||||
|
|
||||||
|
|
||||||
class TestGolemMember(TransactionCase):
|
class TestGolemMember(TransactionCase):
|
||||||
@ -29,95 +28,47 @@ class TestGolemMember(TransactionCase):
|
|||||||
""" Bootstrap member """
|
""" Bootstrap member """
|
||||||
super(TestGolemMember, self).setUp(*args, **kwargs)
|
super(TestGolemMember, self).setUp(*args, **kwargs)
|
||||||
#création du saison
|
#création du saison
|
||||||
self.season = self.env['golem.season'].sudo().create({'name': u'Season 1'})
|
self.season = self.env['golem.season'].create({'name': u'Season 1'})
|
||||||
self.season.do_default_season()
|
|
||||||
#préparation des données pour la création des membres
|
|
||||||
self.data_member_1 = {'lastname': u'LAST1',
|
self.data_member_1 = {'lastname': u'LAST1',
|
||||||
'firstname': u'First1',
|
'firstname': u'First1',
|
||||||
'season_ids':[(4, self.season.id, False)]
|
'season_ids':[(4, self.season.id, False)]}
|
||||||
}
|
|
||||||
self.data_member_2 = {'lastname': u'LAST2',
|
self.data_member_2 = {'lastname': u'LAST2',
|
||||||
'firstname': u'First2',
|
'firstname': u'First2',
|
||||||
'season_ids':[(4, self.season.id, False)]
|
'season_ids':[(4, self.season.id, False)]}
|
||||||
}
|
self.member = self.env['golem.member']
|
||||||
self.member1 = self.env['golem.member']
|
type_id = self.env.ref('golem_activity.golem_activity_type_activity')
|
||||||
self.member2 = self.env['golem.member']
|
|
||||||
#préparation des donnée pour la création de l'activité
|
|
||||||
type_id = self.ref("golem_activity.golem_activity_type_activity")
|
|
||||||
self.data_activity = {
|
self.data_activity = {
|
||||||
'name': u'Activity 1',
|
'name': u'Activity 1',
|
||||||
'season_id': self.season.id,
|
'season_id': self.season.id,
|
||||||
'type_id': type_id}
|
'type_id': type_id.id
|
||||||
|
}
|
||||||
self.activity = self.env['golem.activity']
|
self.activity = self.env['golem.activity']
|
||||||
|
self.activity_registration = self.env['golem.activity.registration']
|
||||||
|
self.activity_queue = self.env['golem.activity.queue']
|
||||||
|
|
||||||
def test_member_creation(self):
|
def test_member_creation(self):
|
||||||
""" Test member creation """
|
""" Test member queue default """
|
||||||
member1 = self.member1.create(self.data_member_1)
|
member1 = self.member.create(self.data_member_1)
|
||||||
#verification que le membre n'est inscrit en aucune attente
|
|
||||||
self.assertFalse(member1.activity_queue_ids)
|
self.assertFalse(member1.activity_queue_ids)
|
||||||
|
|
||||||
|
|
||||||
def test_automated_registration(self):
|
def test_automated_registration(self):
|
||||||
""" Test automated registration """
|
""" Test automated registration """
|
||||||
#création de 2 membre est une activité
|
member1 = self.member.create(self.data_member_1)
|
||||||
member1 = self.member1.create(self.data_member_1)
|
member2 = self.member.create(self.data_member_2)
|
||||||
member2 = self.member2.create(self.data_member_2)
|
|
||||||
activity = self.activity.create(self.data_activity)
|
activity = self.activity.create(self.data_activity)
|
||||||
#membre 1 inscrit sur activity
|
|
||||||
registration = {
|
registration_data = {'activity_id' : activity.id, 'member_id' : member1.id}
|
||||||
'activity_id' : activity.id,
|
queue_data = {'activity_id' : activity.id, 'member_id' : member2.id}
|
||||||
'member_id' : member1.id
|
|
||||||
}
|
|
||||||
#memebre 2 inscrit sur attente
|
|
||||||
queue = {
|
|
||||||
'activity_id' : activity.id,
|
|
||||||
'member_id' : member2.id
|
|
||||||
}
|
|
||||||
#Verification que l'atente est le basculement automatique est aactivé
|
|
||||||
self.assertTrue(activity.queue_allowed)
|
self.assertTrue(activity.queue_allowed)
|
||||||
self.assertTrue(activity.auto_registration_from_queue)
|
self.assertTrue(activity.auto_registration_from_queue)
|
||||||
#réduire le nombre de place sur activity à 1
|
|
||||||
activity.write({'places': 1})
|
activity.places = 1
|
||||||
#enregistrement du membre 1 sur activity et memebre 2 sur attente
|
registration = self.activity_registration.create(registration_data)
|
||||||
activity.write({'activity_registration_ids': [(0, False, registration)]})
|
self.activity_queue.create(queue_data)
|
||||||
activity.write({'activity_queue_ids': [(0, False, queue)]})
|
|
||||||
#vérification des membre 1 sur registration et membre 2 sur attente
|
|
||||||
self.assertEqual(activity.activity_registration_ids[0].member_id, member1)
|
self.assertEqual(activity.activity_registration_ids[0].member_id, member1)
|
||||||
self.assertEqual(activity.activity_queue_ids[0].member_id, member2)
|
self.assertEqual(activity.activity_queue_ids[0].member_id, member2)
|
||||||
#suppression du membre 1 de l'activity
|
|
||||||
member1.write({'activity_registration_ids': [(2,
|
registration.unlink()
|
||||||
member1.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)
|
self.assertEqual(activity.activity_registration_ids[0].member_id, member2)
|
||||||
#verification de l'attente est vide
|
|
||||||
self.assertFalse(activity.activity_queue_ids)
|
self.assertFalse(activity.activity_queue_ids)
|
||||||
|
|
||||||
#test de l'inscription d'un membre à travers l'assistan lancé par le bouton
|
|
||||||
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)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user