blob: f47ad40a1be2dc1943f80a16782b1a4cb5418c54 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import common
class TestRecruitmentSurvey(common.SingleTransactionCase):
@classmethod
def setUpClass(cls):
super(TestRecruitmentSurvey, cls).setUpClass()
# Create some sample data to avoid demo data
cls.department_admins = cls.env['hr.department'].create({'name': 'Admins'})
cls.survey_sysadmin = cls.env['survey.survey'].create({'title': 'Questions for Sysadmin job offer'})
cls.job = cls.env['hr.job'].create({
'name': 'Technical worker',
'survey_id': cls.survey_sysadmin.id,
})
cls.job_sysadmin = cls.env['hr.applicant'].create({
'name': 'Technical worker',
'department_id': cls.department_admins.id,
'description': 'A nice Sys Admin job offer !',
'job_id': cls.job.id,
})
def test_start_survey(self):
# We ensure that response is False because we don't know test order
self.job_sysadmin.response_id = False
action_start = self.job_sysadmin.action_start_survey()
self.assertEqual(action_start['type'], 'ir.actions.act_url')
self.assertNotEqual(self.job_sysadmin.response_id.id, False)
self.assertIn(self.job_sysadmin.response_id.access_token, action_start['url'])
action_start_with_response = self.job_sysadmin.action_start_survey()
self.assertEqual(action_start_with_response, action_start)
def test_print_survey(self):
# We ensure that response is False because we don't know test order
self.job_sysadmin.response_id = False
action_print = self.job_sysadmin.action_print_survey()
self.assertEqual(action_print['type'], 'ir.actions.act_url')
self.job_sysadmin.response_id = self.env['survey.user_input'].create({'survey_id': self.survey_sysadmin.id})
action_print_with_response = self.job_sysadmin.action_print_survey()
self.assertIn(self.job_sysadmin.response_id.access_token, action_print_with_response['url'])
|