|
| 1 | +# -*- coding: utf-8 -*- |
1 | 2 | """ |
2 | 3 | Tests for SGA |
3 | 4 | """ |
@@ -444,6 +445,38 @@ def test_staff_download(self): |
444 | 445 | 'student_id': student['item'].student_id})) |
445 | 446 | self.assertEqual(response.body, expected) |
446 | 447 |
|
| 448 | + def test_download_annotated_unicode_filename(self): |
| 449 | + """ |
| 450 | + Tests download annotated assignment |
| 451 | + with filename in unicode for non staff member. |
| 452 | + """ |
| 453 | + path = pkg_resources.resource_filename(__package__, 'tests.py') |
| 454 | + expected = open(path, 'rb').read() |
| 455 | + upload = mock.Mock(file=DummyUpload(path, 'файл.txt')) |
| 456 | + block = self.make_one() |
| 457 | + fred = self.make_student(block, "fred2") |
| 458 | + block.staff_upload_annotated(mock.Mock(params={ |
| 459 | + 'annotated': upload, |
| 460 | + 'module_id': fred['module'].id})) |
| 461 | + self.personalize(block, **fred) |
| 462 | + response = block.download_annotated(None) |
| 463 | + self.assertEqual(response.body, expected) |
| 464 | + |
| 465 | + def test_staff_download_unicode_filename(self): |
| 466 | + """ |
| 467 | + Tests download assignment with filename in unicode for staff. |
| 468 | + """ |
| 469 | + path = pkg_resources.resource_filename(__package__, 'tests.py') |
| 470 | + expected = open(path, 'rb').read() |
| 471 | + upload = mock.Mock(file=DummyUpload(path, 'файл.txt')) |
| 472 | + block = self.make_one() |
| 473 | + student = self.make_student(block, 'fred') |
| 474 | + self.personalize(block, **student) |
| 475 | + block.upload_assignment(mock.Mock(params={'assignment': upload})) |
| 476 | + response = block.staff_download(mock.Mock(params={ |
| 477 | + 'student_id': student['item'].student_id})) |
| 478 | + self.assertEqual(response.body, expected) |
| 479 | + |
447 | 480 | def test_get_staff_grading_data_not_staff(self): |
448 | 481 | """ |
449 | 482 | test staff grading data for non staff members. |
|
0 commit comments