File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change
1
+ from flask .testing import FlaskClient
1
2
from lms .models .errors import ResourceNotFound
2
3
from lms .models .solutions import get_view_parameters
3
4
from unittest import mock
@@ -504,3 +505,23 @@ def test_manager_can_see_solutions(
504
505
staff_client = conftest .get_logged_user (staff_user .username )
505
506
view_response = staff_client .get (f'{ routes .SOLUTIONS } /{ solution .id } ' )
506
507
assert view_response .status_code == 200
508
+
509
+ @staticmethod
510
+ def test_send_page (
511
+ student_user : User , course : Course , exercise : Exercise ,
512
+ ):
513
+ course2 = conftest .create_course (2 )
514
+ exercise2 = conftest .create_exercise (course2 , 1 )
515
+ conftest .create_usercourse (student_user , course )
516
+ client = conftest .get_logged_user (student_user .username )
517
+ success_send_response = client .get (f'send/{ course .id } ' )
518
+ assert success_send_response .status_code == 200
519
+
520
+ success_send_response2 = client .get (f'send/{ course .id } /{ exercise .id } ' )
521
+ assert success_send_response2 .status_code == 200
522
+
523
+ fail_send_response = client .get (f'send/{ course2 .id } ' )
524
+ assert fail_send_response .status_code == 403
525
+
526
+ fail_send_response = client .get (f'send/{ course2 .id } /{ exercise2 .id } ' )
527
+ assert fail_send_response .status_code == 403
You can’t perform that action at this time.
0 commit comments