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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import odoo.tests
from odoo.addons.base.tests.common import HttpCaseWithUserDemo
@odoo.tests.common.tagged('post_install', '-at_install')
class TestUiCertification(HttpCaseWithUserDemo):
def setUp(self):
super(TestUiCertification, self).setUp()
self.survey_certification = self.env['survey.survey'].create({
'title': 'MyCompany Vendor Certification',
'access_token': '4ead4bc8-b8f2-4760-a682-1fde8daaaaac',
'access_mode': 'public',
'questions_layout': 'one_page',
'users_can_go_back': True,
'users_login_required': True,
'scoring_type': 'scoring_with_answers',
'certification': True,
'certification_mail_template_id': self.env.ref('survey.mail_template_certification').id,
'is_time_limited': 'limited',
'time_limit': 10.0,
'is_attempts_limited': True,
'attempts_limit': 2,
'description': """<p>Test your vendor skills!.</p>""",
'question_and_page_ids': [
(0, 0, {
'title': 'Products',
'sequence': 1,
'is_page': True,
'question_type': False,
'description': '<p>Test your knowledge of your products!</p>',
}), (0, 0, {
'title': 'Do we sell Acoustic Bloc Screens?',
'sequence': 2,
'question_type': 'simple_choice',
'constr_mandatory': True,
'suggested_answer_ids': [
(0, 0, {
'value': 'No',
'sequence': 1,
}), (0, 0, {
'value': 'Yes',
'sequence': 2,
'is_correct': True,
'answer_score': 2,
})
],
}), (0, 0, {
'title': 'Select all the existing products',
'sequence': 3,
'question_type': 'multiple_choice',
'suggested_answer_ids': [
(0, 0, {
'value': 'Chair floor protection',
'sequence': 1,
'is_correct': True,
'answer_score': 1,
}), (0, 0, {
'value': 'Fanta',
'sequence': 2,
'answer_score': -1,
}), (0, 0, {
'value': 'Conference chair',
'sequence': 3,
'is_correct': True,
'answer_score': 1,
}), (0, 0, {
'value': 'Drawer',
'sequence': 4,
'is_correct': True,
'answer_score': 1,
}), (0, 0, {
'value': 'Customizable Lamp',
'sequence': 5,
'answer_score': -1,
})
]
}), (0, 0, {
'title': 'Select all the available customizations for our Customizable Desk',
'sequence': 4,
'question_type': 'multiple_choice',
'suggested_answer_ids': [
(0, 0, {
'value': 'Color',
'sequence': 1,
'is_correct': True,
'answer_score': 1,
}), (0, 0, {
'value': 'Height',
'sequence': 2,
'answer_score': -1,
}), (0, 0, {
'value': 'Width',
'sequence': 3,
'is_correct': True,
'answer_score': 1,
}), (0, 0, {
'value': 'Legs',
'sequence': 4,
'is_correct': True,
'answer_score': 1,
}), (0, 0, {
'value': 'Number of drawers',
'sequence': 5,
'answer_score': -1,
})
]
}), (0, 0, {
'title': 'How many versions of the Corner Desk do we have?',
'sequence': 5,
'question_type': 'simple_choice',
'constr_mandatory': True,
'suggested_answer_ids': [
(0, 0, {
'value': 1,
'sequence': 1,
}), (0, 0, {
'value': 2,
'sequence': 2,
'is_correct': True,
'answer_score': 2,
}), (0, 0, {
'value': 3,
'sequence': 3,
}), (0, 0, {
'value': 4,
'sequence': 4,
})
]
}), (0, 0, {
'title': 'Do you think we have missing products in our catalog? (not rated)',
'sequence': 6,
'question_type': 'text_box',
}), (0, 0, {
'title': 'Prices',
'sequence': 7,
'is_page': True,
'question_type': False,
'description': """<p>Test your knowledge of our prices.</p>""",
}), (0, 0, {
'title': 'How much do we sell our Cable Management Box?',
'sequence': 8,
'question_type': 'simple_choice',
'constr_mandatory': True,
'suggested_answer_ids': [
(0, 0, {
'value': '$20',
'sequence': 1,
}), (0, 0, {
'value': '$50',
'sequence': 2,
}), (0, 0, {
'value': '$80',
'sequence': 3,
}), (0, 0, {
'value': '$100',
'sequence': 4,
'is_correct': True,
'answer_score': 2,
}), (0, 0, {
'value': '$200',
'sequence': 5,
}), (0, 0, {
'value': '$300',
'sequence': 6,
})
]
}), (0, 0, {
'title': 'Select all the products that sell for $100 or more',
'sequence': 9,
'question_type': 'multiple_choice',
'suggested_answer_ids': [
(0, 0, {
'value': 'Corner Desk Right Sit',
'sequence': 1,
'answer_score': 1,
'is_correct': True,
}), (0, 0, {
'value': 'Desk Combination',
'sequence': 2,
'answer_score': 1,
'is_correct': True,
}), (0, 0, {
'value': 'Cabinet with Doors',
'sequence': 3,
'answer_score': -1,
}), (0, 0, {
'value': 'Large Desk',
'sequence': 4,
'answer_score': 1,
'is_correct': True,
}), (0, 0, {
'value': 'Letter Tray',
'sequence': 5,
'answer_score': -1,
}), (0, 0, {
'value': 'Office Chair Black',
'sequence': 6,
'answer_score': -1,
}),
]
}), (0, 0, {
'title': 'What do you think about our prices (not rated)?',
'sequence': 10,
'question_type': 'simple_choice',
'constr_mandatory': True,
'suggested_answer_ids': [
(0, 0, {
'value': 'Very underpriced',
'sequence': 1,
}), (0, 0, {
'value': 'Underpriced',
'sequence': 2,
}), (0, 0, {
'value': 'Correctly priced',
'sequence': 3,
}), (0, 0, {
'value': 'A little bit overpriced',
'sequence': 4,
}), (0, 0, {
'value': 'A lot overpriced',
'sequence': 5,
})
]
}), (0, 0, {
'title': 'Policies',
'sequence': 11,
'is_page': True,
'question_type': False,
'description': """<p>Test your knowledge of our policies.</p>""",
}), (0, 0, {
'title': 'How many days is our money-back guarantee?',
'sequence': 12,
'question_type': 'numerical_box',
'constr_mandatory': True,
'is_scored_question': True,
'answer_numerical_box': 30,
'answer_score': 1,
}), (0, 0, {
'title': 'If a customer purchases a product on 6 January 2020, what is the latest day we expect to ship it?',
'sequence': 13,
'question_type': 'date',
'is_scored_question': True,
'answer_date': '2020-01-08',
'answer_score': 1,
}), (0, 0, {
'title': 'If a customer purchases a 1 year warranty on 6 January 2020, when do we expect the warranty to expire?',
'sequence': 14,
'question_type': 'datetime',
'is_scored_question': True,
'answer_datetime': '2021-01-07 00:00:01',
'answer_score': 1,
}), (0, 0, {
'title': 'What day to you think is best for us to start having an annual sale (not rated)?',
'sequence': 15,
'question_type': 'date',
}), (0, 0, {
'title': 'What day and time do you think most customers are most likely to call customer service (not rated)?',
'sequence': 16,
'question_type': 'datetime',
}), (0, 0, {
'title': 'How many chairs do you think we should aim to sell in a year (not rated)?',
'sequence': 17,
'question_type': 'numerical_box',
})
]
})
def test_04_certification_success_tour(self):
access_token = self.survey_certification.access_token
self.start_tour("/survey/start/%s" % access_token, 'test_certification_success', login="demo")
def test_05_certification_failure_tour(self):
access_token = self.survey_certification.access_token
self.start_tour("/survey/start/%s" % access_token, 'test_certification_failure', login="demo")
|