75 'upassword-subject:X': u'toto', |
76 'upassword-subject:X': u'toto', |
76 'upassword-subject-confirm:X': u'toto', |
77 'upassword-subject-confirm:X': u'toto', |
77 } |
78 } |
78 with self.assertRaises(ValidationError) as cm: |
79 with self.assertRaises(ValidationError) as cm: |
79 self.ctrl_publish(req) |
80 self.ctrl_publish(req) |
80 cm.exception.translate(unicode) |
81 cm.exception.translate(text_type) |
81 self.assertEqual({'login-subject': 'the value "admin" is already used, use another one'}, |
82 self.assertEqual({'login-subject': 'the value "admin" is already used, use another one'}, |
82 cm.exception.errors) |
83 cm.exception.errors) |
83 |
84 |
84 def test_simultaneous_edition_only_one_commit(self): |
85 def test_simultaneous_edition_only_one_commit(self): |
85 """ Allow two simultaneous edit view of the same entity as long as only one commits |
86 """ Allow two simultaneous edit view of the same entity as long as only one commits |
129 """ |
130 """ |
130 with self.admin_access.web_request() as req: |
131 with self.admin_access.web_request() as req: |
131 user = req.user |
132 user = req.user |
132 groupeids = [eid for eid, in req.execute('CWGroup G WHERE G name ' |
133 groupeids = [eid for eid, in req.execute('CWGroup G WHERE G name ' |
133 'in ("managers", "users")')] |
134 'in ("managers", "users")')] |
134 groups = [unicode(eid) for eid in groupeids] |
135 groups = [text_type(eid) for eid in groupeids] |
135 eid = unicode(user.eid) |
136 eid = text_type(user.eid) |
136 req.form = { |
137 req.form = { |
137 'eid': eid, '__type:'+eid: 'CWUser', |
138 'eid': eid, '__type:'+eid: 'CWUser', |
138 '_cw_entity_fields:'+eid: 'login-subject,firstname-subject,surname-subject,in_group-subject', |
139 '_cw_entity_fields:'+eid: 'login-subject,firstname-subject,surname-subject,in_group-subject', |
139 'login-subject:'+eid: unicode(user.login), |
140 'login-subject:'+eid: text_type(user.login), |
140 'surname-subject:'+eid: u'Th\xe9nault', |
141 'surname-subject:'+eid: u'Th\xe9nault', |
141 'firstname-subject:'+eid: u'Sylvain', |
142 'firstname-subject:'+eid: u'Sylvain', |
142 'in_group-subject:'+eid: groups, |
143 'in_group-subject:'+eid: groups, |
143 } |
144 } |
144 self.expect_redirect_handle_request(req, 'edit') |
145 self.expect_redirect_handle_request(req, 'edit') |
152 def test_user_can_change_its_password(self): |
153 def test_user_can_change_its_password(self): |
153 with self.admin_access.repo_cnx() as cnx: |
154 with self.admin_access.repo_cnx() as cnx: |
154 self.create_user(cnx, u'user') |
155 self.create_user(cnx, u'user') |
155 cnx.commit() |
156 cnx.commit() |
156 with self.new_access(u'user').web_request() as req: |
157 with self.new_access(u'user').web_request() as req: |
157 eid = unicode(req.user.eid) |
158 eid = text_type(req.user.eid) |
158 req.form = { |
159 req.form = { |
159 'eid': eid, '__maineid' : eid, |
160 'eid': eid, '__maineid' : eid, |
160 '__type:'+eid: 'CWUser', |
161 '__type:'+eid: 'CWUser', |
161 '_cw_entity_fields:'+eid: 'upassword-subject', |
162 '_cw_entity_fields:'+eid: 'upassword-subject', |
162 'upassword-subject:'+eid: 'tournicoton', |
163 'upassword-subject:'+eid: 'tournicoton', |
172 relations (meaning no changes) |
173 relations (meaning no changes) |
173 """ |
174 """ |
174 with self.admin_access.web_request() as req: |
175 with self.admin_access.web_request() as req: |
175 user = req.user |
176 user = req.user |
176 groupeids = [g.eid for g in user.in_group] |
177 groupeids = [g.eid for g in user.in_group] |
177 eid = unicode(user.eid) |
178 eid = text_type(user.eid) |
178 req.form = { |
179 req.form = { |
179 'eid': eid, |
180 'eid': eid, |
180 '__type:'+eid: 'CWUser', |
181 '__type:'+eid: 'CWUser', |
181 '_cw_entity_fields:'+eid: 'login-subject,firstname-subject,surname-subject', |
182 '_cw_entity_fields:'+eid: 'login-subject,firstname-subject,surname-subject', |
182 'login-subject:'+eid: unicode(user.login), |
183 'login-subject:'+eid: text_type(user.login), |
183 'firstname-subject:'+eid: u'Th\xe9nault', |
184 'firstname-subject:'+eid: u'Th\xe9nault', |
184 'surname-subject:'+eid: u'Sylvain', |
185 'surname-subject:'+eid: u'Sylvain', |
185 } |
186 } |
186 self.expect_redirect_handle_request(req, 'edit') |
187 self.expect_redirect_handle_request(req, 'edit') |
187 e = req.execute('Any X WHERE X eid %(x)s', |
188 e = req.execute('Any X WHERE X eid %(x)s', |
200 '__type:X': 'CWUser', |
201 '__type:X': 'CWUser', |
201 '_cw_entity_fields:X': 'login-subject,upassword-subject,surname-subject,in_group-subject', |
202 '_cw_entity_fields:X': 'login-subject,upassword-subject,surname-subject,in_group-subject', |
202 'login-subject:X': u'adim', |
203 'login-subject:X': u'adim', |
203 'upassword-subject:X': u'toto', 'upassword-subject-confirm:X': u'toto', |
204 'upassword-subject:X': u'toto', 'upassword-subject-confirm:X': u'toto', |
204 'surname-subject:X': u'Di Mascio', |
205 'surname-subject:X': u'Di Mascio', |
205 'in_group-subject:X': unicode(gueid), |
206 'in_group-subject:X': text_type(gueid), |
206 |
207 |
207 '__type:Y': 'EmailAddress', |
208 '__type:Y': 'EmailAddress', |
208 '_cw_entity_fields:Y': 'address-subject,use_email-object', |
209 '_cw_entity_fields:Y': 'address-subject,use_email-object', |
209 'address-subject:Y': u'dima@logilab.fr', |
210 'address-subject:Y': u'dima@logilab.fr', |
210 'use_email-object:Y': 'X', |
211 'use_email-object:Y': 'X', |
267 |
268 |
268 def test_edit_mandatory_inlined3_object(self): |
269 def test_edit_mandatory_inlined3_object(self): |
269 # non regression test for #3120495. Without the fix, leads to |
270 # non regression test for #3120495. Without the fix, leads to |
270 # "unhashable type: 'list'" error |
271 # "unhashable type: 'list'" error |
271 with self.admin_access.web_request() as req: |
272 with self.admin_access.web_request() as req: |
272 cwrelation = unicode(req.execute('CWEType X WHERE X name "CWSource"')[0][0]) |
273 cwrelation = text_type(req.execute('CWEType X WHERE X name "CWSource"')[0][0]) |
273 req.form = {'eid': [cwrelation], '__maineid' : cwrelation, |
274 req.form = {'eid': [cwrelation], '__maineid' : cwrelation, |
274 |
275 |
275 '__type:'+cwrelation: 'CWEType', |
276 '__type:'+cwrelation: 'CWEType', |
276 '_cw_entity_fields:'+cwrelation: 'to_entity-object', |
277 '_cw_entity_fields:'+cwrelation: 'to_entity-object', |
277 'to_entity-object:'+cwrelation: [9999, 9998], |
278 'to_entity-object:'+cwrelation: [9999, 9998], |
280 path, _params = self.expect_redirect_handle_request(req, 'edit') |
281 path, _params = self.expect_redirect_handle_request(req, 'edit') |
281 self.assertTrue(path.startswith('cwetype/CWSource'), path) |
282 self.assertTrue(path.startswith('cwetype/CWSource'), path) |
282 |
283 |
283 def test_edit_multiple_linked(self): |
284 def test_edit_multiple_linked(self): |
284 with self.admin_access.web_request() as req: |
285 with self.admin_access.web_request() as req: |
285 peid = unicode(self.create_user(req, u'adim').eid) |
286 peid = text_type(self.create_user(req, u'adim').eid) |
286 req.form = {'eid': [peid, 'Y'], '__maineid': peid, |
287 req.form = {'eid': [peid, 'Y'], '__maineid': peid, |
287 |
288 |
288 '__type:'+peid: u'CWUser', |
289 '__type:'+peid: u'CWUser', |
289 '_cw_entity_fields:'+peid: u'surname-subject', |
290 '_cw_entity_fields:'+peid: u'surname-subject', |
290 'surname-subject:'+peid: u'Di Masci', |
291 'surname-subject:'+peid: u'Di Masci', |
300 e = req.execute('Any P WHERE P surname "Di Masci"').get_entity(0, 0) |
301 e = req.execute('Any P WHERE P surname "Di Masci"').get_entity(0, 0) |
301 email = e.use_email[0] |
302 email = e.use_email[0] |
302 self.assertEqual(email.address, 'dima@logilab.fr') |
303 self.assertEqual(email.address, 'dima@logilab.fr') |
303 |
304 |
304 # with self.admin_access.web_request() as req: |
305 # with self.admin_access.web_request() as req: |
305 emaileid = unicode(email.eid) |
306 emaileid = text_type(email.eid) |
306 req.form = {'eid': [peid, emaileid], |
307 req.form = {'eid': [peid, emaileid], |
307 |
308 |
308 '__type:'+peid: u'CWUser', |
309 '__type:'+peid: u'CWUser', |
309 '_cw_entity_fields:'+peid: u'surname-subject', |
310 '_cw_entity_fields:'+peid: u'surname-subject', |
310 'surname-subject:'+peid: u'Di Masci', |
311 'surname-subject:'+peid: u'Di Masci', |
322 """test creation of two linked entities |
323 """test creation of two linked entities |
323 """ |
324 """ |
324 with self.admin_access.web_request() as req: |
325 with self.admin_access.web_request() as req: |
325 user = req.user |
326 user = req.user |
326 req.form = {'eid': 'X', |
327 req.form = {'eid': 'X', |
327 '__cloned_eid:X': unicode(user.eid), '__type:X': 'CWUser', |
328 '__cloned_eid:X': text_type(user.eid), '__type:X': 'CWUser', |
328 '_cw_entity_fields:X': 'login-subject,upassword-subject', |
329 '_cw_entity_fields:X': 'login-subject,upassword-subject', |
329 'login-subject:X': u'toto', |
330 'login-subject:X': u'toto', |
330 'upassword-subject:X': u'toto', |
331 'upassword-subject:X': u'toto', |
331 } |
332 } |
332 with self.assertRaises(ValidationError) as cm: |
333 with self.assertRaises(ValidationError) as cm: |
333 self.ctrl_publish(req) |
334 self.ctrl_publish(req) |
334 self.assertEqual({'upassword-subject': u'password and confirmation don\'t match'}, |
335 self.assertEqual({'upassword-subject': u'password and confirmation don\'t match'}, |
335 cm.exception.errors) |
336 cm.exception.errors) |
336 req.form = {'__cloned_eid:X': unicode(user.eid), |
337 req.form = {'__cloned_eid:X': text_type(user.eid), |
337 'eid': 'X', '__type:X': 'CWUser', |
338 'eid': 'X', '__type:X': 'CWUser', |
338 '_cw_entity_fields:X': 'login-subject,upassword-subject', |
339 '_cw_entity_fields:X': 'login-subject,upassword-subject', |
339 'login-subject:X': u'toto', |
340 'login-subject:X': u'toto', |
340 'upassword-subject:X': u'toto', |
341 'upassword-subject:X': u'toto', |
341 'upassword-subject-confirm:X': u'tutu', |
342 'upassword-subject-confirm:X': u'tutu', |
355 with self.admin_access.web_request(rollbackfirst=True) as req: |
356 with self.admin_access.web_request(rollbackfirst=True) as req: |
356 req.form = {'eid': ['X'], |
357 req.form = {'eid': ['X'], |
357 '__type:X': 'Salesterm', |
358 '__type:X': 'Salesterm', |
358 '_cw_entity_fields:X': 'amount-subject,described_by_test-subject', |
359 '_cw_entity_fields:X': 'amount-subject,described_by_test-subject', |
359 'amount-subject:X': u'-10', |
360 'amount-subject:X': u'-10', |
360 'described_by_test-subject:X': unicode(feid), |
361 'described_by_test-subject:X': text_type(feid), |
361 } |
362 } |
362 with self.assertRaises(ValidationError) as cm: |
363 with self.assertRaises(ValidationError) as cm: |
363 self.ctrl_publish(req) |
364 self.ctrl_publish(req) |
364 cm.exception.translate(unicode) |
365 cm.exception.translate(text_type) |
365 self.assertEqual({'amount-subject': 'value -10 must be >= 0'}, |
366 self.assertEqual({'amount-subject': 'value -10 must be >= 0'}, |
366 cm.exception.errors) |
367 cm.exception.errors) |
367 |
368 |
368 with self.admin_access.web_request(rollbackfirst=True) as req: |
369 with self.admin_access.web_request(rollbackfirst=True) as req: |
369 req.form = {'eid': ['X'], |
370 req.form = {'eid': ['X'], |
370 '__type:X': 'Salesterm', |
371 '__type:X': 'Salesterm', |
371 '_cw_entity_fields:X': 'amount-subject,described_by_test-subject', |
372 '_cw_entity_fields:X': 'amount-subject,described_by_test-subject', |
372 'amount-subject:X': u'110', |
373 'amount-subject:X': u'110', |
373 'described_by_test-subject:X': unicode(feid), |
374 'described_by_test-subject:X': text_type(feid), |
374 } |
375 } |
375 with self.assertRaises(ValidationError) as cm: |
376 with self.assertRaises(ValidationError) as cm: |
376 self.ctrl_publish(req) |
377 self.ctrl_publish(req) |
377 cm.exception.translate(unicode) |
378 cm.exception.translate(text_type) |
378 self.assertEqual(cm.exception.errors, {'amount-subject': 'value 110 must be <= 100'}) |
379 self.assertEqual(cm.exception.errors, {'amount-subject': 'value 110 must be <= 100'}) |
379 |
380 |
380 with self.admin_access.web_request(rollbackfirst=True) as req: |
381 with self.admin_access.web_request(rollbackfirst=True) as req: |
381 req.form = {'eid': ['X'], |
382 req.form = {'eid': ['X'], |
382 '__type:X': 'Salesterm', |
383 '__type:X': 'Salesterm', |
383 '_cw_entity_fields:X': 'amount-subject,described_by_test-subject', |
384 '_cw_entity_fields:X': 'amount-subject,described_by_test-subject', |
384 'amount-subject:X': u'10', |
385 'amount-subject:X': u'10', |
385 'described_by_test-subject:X': unicode(feid), |
386 'described_by_test-subject:X': text_type(feid), |
386 } |
387 } |
387 self.expect_redirect_handle_request(req, 'edit') |
388 self.expect_redirect_handle_request(req, 'edit') |
388 # should be redirected on the created |
389 # should be redirected on the created |
389 #eid = params['rql'].split()[-1] |
390 #eid = params['rql'].split()[-1] |
390 e = req.execute('Salesterm X').get_entity(0, 0) |
391 e = req.execute('Salesterm X').get_entity(0, 0) |
399 seid = cnx.create_entity('Salesterm', amount=0, described_by_test=feid).eid |
400 seid = cnx.create_entity('Salesterm', amount=0, described_by_test=feid).eid |
400 cnx.commit() |
401 cnx.commit() |
401 |
402 |
402 # ensure a value that violate a constraint is properly detected |
403 # ensure a value that violate a constraint is properly detected |
403 with self.admin_access.web_request(rollbackfirst=True) as req: |
404 with self.admin_access.web_request(rollbackfirst=True) as req: |
404 req.form = {'eid': [unicode(seid)], |
405 req.form = {'eid': [text_type(seid)], |
405 '__type:%s'%seid: 'Salesterm', |
406 '__type:%s'%seid: 'Salesterm', |
406 '_cw_entity_fields:%s'%seid: 'amount-subject', |
407 '_cw_entity_fields:%s'%seid: 'amount-subject', |
407 'amount-subject:%s'%seid: u'-10', |
408 'amount-subject:%s'%seid: u'-10', |
408 } |
409 } |
409 self.assertMultiLineEqual('''<script type="text/javascript"> |
410 self.assertMultiLineEqual('''<script type="text/javascript"> |
410 window.parent.handleFormValidationResponse('entityForm', null, null, [false, [%s, {"amount-subject": "value -10 must be >= 0"}], null], null); |
411 window.parent.handleFormValidationResponse('entityForm', null, null, [false, [%s, {"amount-subject": "value -10 must be >= 0"}], null], null); |
411 </script>'''%seid, self.ctrl_publish(req, 'validateform')) |
412 </script>'''%seid, self.ctrl_publish(req, 'validateform')) |
412 |
413 |
413 # ensure a value that comply a constraint is properly processed |
414 # ensure a value that comply a constraint is properly processed |
414 with self.admin_access.web_request(rollbackfirst=True) as req: |
415 with self.admin_access.web_request(rollbackfirst=True) as req: |
415 req.form = {'eid': [unicode(seid)], |
416 req.form = {'eid': [text_type(seid)], |
416 '__type:%s'%seid: 'Salesterm', |
417 '__type:%s'%seid: 'Salesterm', |
417 '_cw_entity_fields:%s'%seid: 'amount-subject', |
418 '_cw_entity_fields:%s'%seid: 'amount-subject', |
418 'amount-subject:%s'%seid: u'20', |
419 'amount-subject:%s'%seid: u'20', |
419 } |
420 } |
420 self.assertMultiLineEqual('''<script type="text/javascript"> |
421 self.assertMultiLineEqual('''<script type="text/javascript"> |
426 with self.admin_access.web_request(rollbackfirst=True) as req: |
427 with self.admin_access.web_request(rollbackfirst=True) as req: |
427 req.form = {'eid': ['X'], |
428 req.form = {'eid': ['X'], |
428 '__type:X': 'Salesterm', |
429 '__type:X': 'Salesterm', |
429 '_cw_entity_fields:X': 'amount-subject,described_by_test-subject', |
430 '_cw_entity_fields:X': 'amount-subject,described_by_test-subject', |
430 'amount-subject:X': u'0', |
431 'amount-subject:X': u'0', |
431 'described_by_test-subject:X': unicode(feid), |
432 'described_by_test-subject:X': text_type(feid), |
432 } |
433 } |
433 |
434 |
434 # ensure a value that is modified in an operation on a modify |
435 # ensure a value that is modified in an operation on a modify |
435 # hook works as it should (see |
436 # hook works as it should (see |
436 # https://www.cubicweb.org/ticket/2509729 ) |
437 # https://www.cubicweb.org/ticket/2509729 ) |
534 self.assertEqual(params['toto'], 'tutu') |
535 self.assertEqual(params['toto'], 'tutu') |
535 |
536 |
536 def test_redirect_delete_button(self): |
537 def test_redirect_delete_button(self): |
537 with self.admin_access.web_request() as req: |
538 with self.admin_access.web_request() as req: |
538 eid = req.create_entity('BlogEntry', title=u'hop', content=u'hop').eid |
539 eid = req.create_entity('BlogEntry', title=u'hop', content=u'hop').eid |
539 req.form = {'eid': unicode(eid), '__type:%s'%eid: 'BlogEntry', |
540 req.form = {'eid': text_type(eid), '__type:%s'%eid: 'BlogEntry', |
540 '__action_delete': ''} |
541 '__action_delete': ''} |
541 path, params = self.expect_redirect_handle_request(req, 'edit') |
542 path, params = self.expect_redirect_handle_request(req, 'edit') |
542 self.assertEqual(path, 'blogentry') |
543 self.assertEqual(path, 'blogentry') |
543 self.assertIn('_cwmsgid', params) |
544 self.assertIn('_cwmsgid', params) |
544 eid = req.create_entity('EmailAddress', address=u'hop@logilab.fr').eid |
545 eid = req.create_entity('EmailAddress', address=u'hop@logilab.fr').eid |
545 req.execute('SET X use_email E WHERE E eid %(e)s, X eid %(x)s', |
546 req.execute('SET X use_email E WHERE E eid %(e)s, X eid %(x)s', |
546 {'x': req.user.eid, 'e': eid}) |
547 {'x': req.user.eid, 'e': eid}) |
547 req.cnx.commit() |
548 req.cnx.commit() |
548 req.form = {'eid': unicode(eid), '__type:%s'%eid: 'EmailAddress', |
549 req.form = {'eid': text_type(eid), '__type:%s'%eid: 'EmailAddress', |
549 '__action_delete': ''} |
550 '__action_delete': ''} |
550 path, params = self.expect_redirect_handle_request(req, 'edit') |
551 path, params = self.expect_redirect_handle_request(req, 'edit') |
551 self.assertEqual(path, 'cwuser/admin') |
552 self.assertEqual(path, 'cwuser/admin') |
552 self.assertIn('_cwmsgid', params) |
553 self.assertIn('_cwmsgid', params) |
553 eid1 = req.create_entity('BlogEntry', title=u'hop', content=u'hop').eid |
554 eid1 = req.create_entity('BlogEntry', title=u'hop', content=u'hop').eid |
554 eid2 = req.create_entity('EmailAddress', address=u'hop@logilab.fr').eid |
555 eid2 = req.create_entity('EmailAddress', address=u'hop@logilab.fr').eid |
555 req.form = {'eid': [unicode(eid1), unicode(eid2)], |
556 req.form = {'eid': [text_type(eid1), text_type(eid2)], |
556 '__type:%s'%eid1: 'BlogEntry', |
557 '__type:%s'%eid1: 'BlogEntry', |
557 '__type:%s'%eid2: 'EmailAddress', |
558 '__type:%s'%eid2: 'EmailAddress', |
558 '__action_delete': ''} |
559 '__action_delete': ''} |
559 path, params = self.expect_redirect_handle_request(req, 'edit') |
560 path, params = self.expect_redirect_handle_request(req, 'edit') |
560 self.assertEqual(path, 'view') |
561 self.assertEqual(path, 'view') |
600 """ |
601 """ |
601 with self.admin_access.web_request() as req: |
602 with self.admin_access.web_request() as req: |
602 groupeids = sorted(eid |
603 groupeids = sorted(eid |
603 for eid, in req.execute('CWGroup G ' |
604 for eid, in req.execute('CWGroup G ' |
604 'WHERE G name in ("managers", "users")')) |
605 'WHERE G name in ("managers", "users")')) |
605 groups = [unicode(eid) for eid in groupeids] |
606 groups = [text_type(eid) for eid in groupeids] |
606 cwetypeeid = req.execute('CWEType X WHERE X name "CWEType"')[0][0] |
607 cwetypeeid = req.execute('CWEType X WHERE X name "CWEType"')[0][0] |
607 basegroups = [unicode(eid) |
608 basegroups = [text_type(eid) |
608 for eid, in req.execute('CWGroup G ' |
609 for eid, in req.execute('CWGroup G ' |
609 'WHERE X read_permission G, X eid %(x)s', |
610 'WHERE X read_permission G, X eid %(x)s', |
610 {'x': cwetypeeid})] |
611 {'x': cwetypeeid})] |
611 cwetypeeid = unicode(cwetypeeid) |
612 cwetypeeid = text_type(cwetypeeid) |
612 req.form = { |
613 req.form = { |
613 'eid': cwetypeeid, |
614 'eid': cwetypeeid, |
614 '__type:'+cwetypeeid: 'CWEType', |
615 '__type:'+cwetypeeid: 'CWEType', |
615 '_cw_entity_fields:'+cwetypeeid: 'name-subject,final-subject,description-subject,read_permission-subject', |
616 '_cw_entity_fields:'+cwetypeeid: 'name-subject,final-subject,description-subject,read_permission-subject', |
616 'name-subject:'+cwetypeeid: u'CWEType', |
617 'name-subject:'+cwetypeeid: u'CWEType', |
880 |
881 |
881 |
882 |
882 # silly tests |
883 # silly tests |
883 def test_external_resource(self): |
884 def test_external_resource(self): |
884 with self.remote_calling('external_resource', 'RSS_LOGO') as (res, _): |
885 with self.remote_calling('external_resource', 'RSS_LOGO') as (res, _): |
885 self.assertEqual(json_dumps(self.config.uiprops['RSS_LOGO']), |
886 self.assertEqual(json_dumps(self.config.uiprops['RSS_LOGO']).encode('ascii'), |
886 res) |
887 res) |
887 |
888 |
888 def test_i18n(self): |
889 def test_i18n(self): |
889 with self.remote_calling('i18n', ['bimboom']) as (res, _): |
890 with self.remote_calling('i18n', ['bimboom']) as (res, _): |
890 self.assertEqual(json_dumps(['bimboom']), res) |
891 self.assertEqual(json_dumps(['bimboom']).encode('ascii'), res) |
891 |
892 |
892 def test_format_date(self): |
893 def test_format_date(self): |
893 with self.remote_calling('format_date', '2007-01-01 12:00:00') as (res, _): |
894 with self.remote_calling('format_date', '2007-01-01 12:00:00') as (res, _): |
894 self.assertEqual(json_dumps('2007/01/01'), res) |
895 self.assertEqual(json_dumps('2007/01/01').encode('ascii'), res) |
895 |
896 |
896 def test_ajaxfunc_noparameter(self): |
897 def test_ajaxfunc_noparameter(self): |
897 @ajaxfunc |
898 @ajaxfunc |
898 def foo(self, x, y): |
899 def foo(self, x, y): |
899 return 'hello' |
900 return 'hello' |