forked from Yaltik/golem
1er version des tests fonctionnels
This commit is contained in:
parent
375fe6b552
commit
1faad1bf15
@ -19,6 +19,7 @@
|
|||||||
{
|
{
|
||||||
'name': 'GOLEM activities queue',
|
'name': 'GOLEM activities queue',
|
||||||
'summary': 'GOLEM activities queue',
|
'summary': 'GOLEM activities queue',
|
||||||
|
'description': ''' GOLEM resources management ''',
|
||||||
'version': '10.0.2.1.0',
|
'version': '10.0.2.1.0',
|
||||||
'category': 'GOLEM',
|
'category': 'GOLEM',
|
||||||
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
||||||
@ -27,6 +28,7 @@
|
|||||||
'installable': True,
|
'installable': True,
|
||||||
'depends': ['golem_activity', 'golem_activity_registration'],
|
'depends': ['golem_activity', 'golem_activity_registration'],
|
||||||
'data': [
|
'data': [
|
||||||
|
'security/ir.model.access.csv',
|
||||||
'views/golem_activity_queue_views.xml',
|
'views/golem_activity_queue_views.xml',
|
||||||
'views/golem_activity_views.xml',
|
'views/golem_activity_views.xml',
|
||||||
'views/golem_member_views.xml',
|
'views/golem_member_views.xml',
|
||||||
|
@ -24,25 +24,20 @@ class TestGolemActivity(TransactionCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestGolemActivity, self).setUp()
|
super(TestGolemActivity, self).setUp()
|
||||||
|
self.season = self.env['golem.season'].sudo().create({'name': u'Season 1'})
|
||||||
self.season_model = self.env['golem.season'].sudo()
|
type_id = self.ref("golem_activity.golem_activity_type_activity")
|
||||||
season_data = {'name': u'Current', 'date_start': '2010-01-01',
|
#self.activity = self.env['golem.activity'].create({'name': u'Activity 1',
|
||||||
'date_end': '2010-12-31'}
|
# 'season_id': self.season,
|
||||||
self.season_current = self.season_model.create(season_data)
|
# 'categ_id': categ})
|
||||||
self.activity_model = self.env['golem.activity'].sudo()
|
self.data = {
|
||||||
|
'name': u'Activity 1',
|
||||||
|
'season_id': self.season.id,
|
||||||
|
'type_id': type_id
|
||||||
|
}
|
||||||
|
self.activity_obj = self.env['golem.activity']
|
||||||
def test_activity_creation(self):
|
def test_activity_creation(self):
|
||||||
""" Test creation of activity and periods """
|
""" Test creation of activity """
|
||||||
categ = self.ref('golem_activity.golem_product_category_activities')
|
activity = self.activity_obj.create(self.data)
|
||||||
adata = {'name': 'a1', 'season_id': self.season_current.id,
|
self.assertTrue(activity.queue_allowed)
|
||||||
'categ_id': categ}
|
self.assertTrue(activity.auto_registration_from_queue)
|
||||||
a1 = self.activity_model.create(adata)
|
self.assertEqual(activity.queue_activity_number, 0)
|
||||||
a1.onchange_season_dates()
|
|
||||||
self.assertEqual(a1.name, 'a1')
|
|
||||||
self.assertEqual(a1.date_start, self.season_current.date_start)
|
|
||||||
self.assertEqual(a1.date_end, self.season_current.date_end)
|
|
||||||
self.assertTrue(a1.is_current)
|
|
||||||
adata.update({'name': 'a2', 'date_start': '2010-01-01',
|
|
||||||
'date_end': '2009-12-01'})
|
|
||||||
with self.assertRaises(ValidationError):
|
|
||||||
self.activity_model.create(adata)
|
|
||||||
|
@ -30,10 +30,13 @@ class TestGolemActivityQueue(TransactionCase):
|
|||||||
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'].sudo().create({'name': u'Season 1'})
|
||||||
categ = self.ref('golem_activity.golem_product_category_activities')
|
type_id = self.ref("golem_activity.golem_activity_type_activity")
|
||||||
|
print "_______________________"
|
||||||
|
print self.season
|
||||||
|
print type_id
|
||||||
self.activity = self.env['golem.activity'].create({'name': u'Activity 1',
|
self.activity = self.env['golem.activity'].create({'name': u'Activity 1',
|
||||||
'season_id': self.season,
|
'season_id': self.season.id,
|
||||||
'categ_id': categ})
|
'type_id': type_id})
|
||||||
self.member = self.env['golem.member'].create({
|
self.member = self.env['golem.member'].create({
|
||||||
'lastname': u'LAST',
|
'lastname': u'LAST',
|
||||||
'firstname': u'First'
|
'firstname': u'First'
|
||||||
|
Loading…
Reference in New Issue
Block a user