5454
5555
5656class TestRiskAcceptanceExposure (DojoTestCase ):
57+
5758 """FindingSerializer must not expose accepted_risks to users without Risk_Acceptance permission."""
5859
5960 @classmethod
@@ -72,12 +73,12 @@ def setUpTestData(cls):
7273 # Create users
7374 cls .reader_user = Dojo_User .objects .create_user (
7475 username = "ra_test_reader" ,
75- password = "testTEST1234!@#$" ,
76+ password = "testTEST1234!@#$" , # noqa: S106
7677 is_active = True ,
7778 )
7879 cls .writer_user = Dojo_User .objects .create_user (
7980 username = "ra_test_writer" ,
80- password = "testTEST1234!@#$" ,
81+ password = "testTEST1234!@#$" , # noqa: S106
8182 is_active = True ,
8283 )
8384
@@ -145,6 +146,7 @@ def test_writer_can_see_accepted_risks(self):
145146
146147
147148class TestMetadataBatchPermissions (DojoTestCase ):
149+
148150 """Metadata batch endpoint must enforce permissions on parent objects."""
149151
150152 @classmethod
@@ -170,7 +172,7 @@ def setUpTestData(cls):
170172 # User with Writer on accessible product, no role on inaccessible product
171173 cls .writer_user = Dojo_User .objects .create_user (
172174 username = "meta_batch_writer" ,
173- password = "testTEST1234!@#$" ,
175+ password = "testTEST1234!@#$" , # noqa: S106
174176 is_active = True ,
175177 )
176178 Product_Member .objects .create (
@@ -182,7 +184,7 @@ def setUpTestData(cls):
182184 # User with Reader on accessible product (Reader lacks Product_Edit)
183185 cls .reader_user = Dojo_User .objects .create_user (
184186 username = "meta_batch_reader" ,
185- password = "testTEST1234!@#$" ,
187+ password = "testTEST1234!@#$" , # noqa: S106
186188 is_active = True ,
187189 )
188190 Product_Member .objects .create (
@@ -235,6 +237,7 @@ def test_batch_post_reader_cannot_edit(self):
235237
236238
237239class TestNoteRelationshipVerification (DojoTestCase ):
240+
238241 """Regression: remove_note must verify the note belongs to the finding."""
239242
240243 @classmethod
@@ -250,7 +253,7 @@ def setUpTestData(cls):
250253
251254 cls .user = Dojo_User .objects .create_user (
252255 username = "note_test_owner" ,
253- password = "testTEST1234!@#$" ,
256+ password = "testTEST1234!@#$" , # noqa: S106
254257 is_active = True ,
255258 )
256259 Product_Member .objects .create (
@@ -334,6 +337,7 @@ def test_remove_note_from_correct_finding(self):
334337
335338
336339class TestBenchmarkIDOR (DojoTestCase ):
340+
337341 """update_benchmark must reject bench_id belonging to a different product."""
338342
339343 @classmethod
@@ -356,7 +360,7 @@ def setUpTestData(cls):
356360 # User with Owner on both products
357361 cls .user = Dojo_User .objects .create_user (
358362 username = "bench_idor_owner" ,
359- password = "testTEST1234!@#$" ,
363+ password = "testTEST1234!@#$" , # noqa: S106
360364 is_active = True ,
361365 )
362366 Product_Member .objects .create (
@@ -397,7 +401,7 @@ def setUpTestData(cls):
397401 def test_update_benchmark_cross_product_rejected (self ):
398402 """POSTing a bench_id from product A via product B's URL must be denied."""
399403 client = Client ()
400- client .login (username = "bench_idor_owner" , password = "testTEST1234!@#$" )
404+ client .login (username = "bench_idor_owner" , password = "testTEST1234!@#$" ) # noqa: S106
401405
402406 # Try to update product A's benchmark through product B's endpoint
403407 url = reverse (
@@ -416,7 +420,7 @@ def test_update_benchmark_cross_product_rejected(self):
416420 def test_update_benchmark_summary_cross_product_rejected (self ):
417421 """POSTing a summary from product A via product B's URL must be denied."""
418422 client = Client ()
419- client .login (username = "bench_idor_owner" , password = "testTEST1234!@#$" )
423+ client .login (username = "bench_idor_owner" , password = "testTEST1234!@#$" ) # noqa: S106
420424
421425 url = reverse (
422426 "update_product_benchmark_summary" ,
@@ -433,7 +437,7 @@ def test_update_benchmark_summary_cross_product_rejected(self):
433437 def test_update_benchmark_same_product_allowed (self ):
434438 """POSTing a bench_id for the correct product should succeed."""
435439 client = Client ()
436- client .login (username = "bench_idor_owner" , password = "testTEST1234!@#$" )
440+ client .login (username = "bench_idor_owner" , password = "testTEST1234!@#$" ) # noqa: S106
437441
438442 url = reverse (
439443 "update_product_benchmark" ,
@@ -448,6 +452,7 @@ def test_update_benchmark_same_product_allowed(self):
448452
449453
450454class TestObjectProductParentCheck (DojoTestCase ):
455+
451456 """edit_object and delete_object must reject objects from different products."""
452457
453458 @classmethod
@@ -468,7 +473,7 @@ def setUpTestData(cls):
468473
469474 cls .user = Dojo_User .objects .create_user (
470475 username = "object_parent_owner" ,
471- password = "testTEST1234!@#$" ,
476+ password = "testTEST1234!@#$" , # noqa: S106
472477 is_active = True ,
473478 )
474479 Product_Member .objects .create (
@@ -491,7 +496,7 @@ def setUpTestData(cls):
491496 def test_edit_object_cross_product_rejected (self ):
492497 """Editing an object from product A via product B's URL must be denied."""
493498 client = Client ()
494- client .login (username = "object_parent_owner" , password = "testTEST1234!@#$" )
499+ client .login (username = "object_parent_owner" , password = "testTEST1234!@#$" ) # noqa: S106
495500
496501 url = reverse ("edit_object" , args = (self .product_b .id , self .tracked_file .id ))
497502 response = client .get (url )
@@ -501,7 +506,7 @@ def test_edit_object_cross_product_rejected(self):
501506 def test_delete_object_cross_product_rejected (self ):
502507 """Deleting an object from product A via product B's URL must be denied."""
503508 client = Client ()
504- client .login (username = "object_parent_owner" , password = "testTEST1234!@#$" )
509+ client .login (username = "object_parent_owner" , password = "testTEST1234!@#$" ) # noqa: S106
505510
506511 url = reverse ("delete_object" , args = (self .product_b .id , self .tracked_file .id ))
507512 response = client .get (url )
@@ -510,6 +515,7 @@ def test_delete_object_cross_product_rejected(self):
510515
511516
512517class TestToolProductParentCheck (DojoTestCase ):
518+
513519 """edit_tool_product and delete_tool_product must reject tools from different products."""
514520
515521 @classmethod
@@ -530,7 +536,7 @@ def setUpTestData(cls):
530536
531537 cls .user = Dojo_User .objects .create_user (
532538 username = "tool_parent_owner" ,
533- password = "testTEST1234!@#$" ,
539+ password = "testTEST1234!@#$" , # noqa: S106
534540 is_active = True ,
535541 )
536542 Product_Member .objects .create (
@@ -555,7 +561,7 @@ def setUpTestData(cls):
555561 def test_edit_tool_product_cross_product_rejected (self ):
556562 """Editing a tool setting from product A via product B's URL must be denied."""
557563 client = Client ()
558- client .login (username = "tool_parent_owner" , password = "testTEST1234!@#$" )
564+ client .login (username = "tool_parent_owner" , password = "testTEST1234!@#$" ) # noqa: S106
559565
560566 url = reverse ("edit_tool_product" , args = (self .product_b .id , self .tool_setting .id ))
561567 response = client .get (url )
@@ -565,7 +571,7 @@ def test_edit_tool_product_cross_product_rejected(self):
565571 def test_delete_tool_product_cross_product_rejected (self ):
566572 """Deleting a tool setting from product A via product B's URL must be denied."""
567573 client = Client ()
568- client .login (username = "tool_parent_owner" , password = "testTEST1234!@#$" )
574+ client .login (username = "tool_parent_owner" , password = "testTEST1234!@#$" ) # noqa: S106
569575
570576 url = reverse ("delete_tool_product" , args = (self .product_b .id , self .tool_setting .id ))
571577 response = client .get (url )
@@ -574,8 +580,11 @@ def test_delete_tool_product_cross_product_rejected(self):
574580
575581
576582class TestRiskAcceptanceCrossEngagementIDOR (DojoTestCase ):
577- """H1 #3577434 / #3569882: Risk acceptance endpoints must reject
578- a raid belonging to a different engagement than the eid in the URL."""
583+
584+ """
585+ H1 #3577434 / #3569882: Risk acceptance endpoints must reject
586+ a raid belonging to a different engagement than the eid in the URL.
587+ """
579588
580589 @classmethod
581590 def setUpTestData (cls ):
@@ -588,7 +597,7 @@ def setUpTestData(cls):
588597 )
589598 cls .user = Dojo_User .objects .create_user (
590599 username = "ra_idor_owner" ,
591- password = "testTEST1234!@#$" ,
600+ password = "testTEST1234!@#$" , # noqa: S106
592601 is_active = True ,
593602 )
594603 Product_Member .objects .create (
@@ -633,7 +642,7 @@ def setUpTestData(cls):
633642
634643 def _login (self ):
635644 client = Client ()
636- client .login (username = "ra_idor_owner" , password = "testTEST1234!@#$" )
645+ client .login (username = "ra_idor_owner" , password = "testTEST1234!@#$" ) # noqa: S106
637646 return client
638647
639648 def test_view_risk_acceptance_cross_engagement (self ):
@@ -692,8 +701,11 @@ def test_view_risk_acceptance_same_engagement(self):
692701
693702
694703class TestEngagementPresetsCrossProductIDOR (DojoTestCase ):
695- """H1 #3577398 / #3570349: Engagement preset endpoints must reject
696- a preset belonging to a different product than the pid in the URL."""
704+
705+ """
706+ H1 #3577398 / #3570349: Engagement preset endpoints must reject
707+ a preset belonging to a different product than the pid in the URL.
708+ """
697709
698710 @classmethod
699711 def setUpTestData (cls ):
@@ -713,7 +725,7 @@ def setUpTestData(cls):
713725
714726 cls .user = Dojo_User .objects .create_user (
715727 username = "preset_idor_owner" ,
716- password = "testTEST1234!@#$" ,
728+ password = "testTEST1234!@#$" , # noqa: S106
717729 is_active = True ,
718730 )
719731 Product_Member .objects .create (
@@ -732,7 +744,7 @@ def setUpTestData(cls):
732744
733745 def _login (self ):
734746 client = Client ()
735- client .login (username = "preset_idor_owner" , password = "testTEST1234!@#$" )
747+ client .login (username = "preset_idor_owner" , password = "testTEST1234!@#$" ) # noqa: S106
736748 return client
737749
738750 def test_edit_preset_cross_product (self ):
@@ -765,8 +777,11 @@ def test_edit_preset_same_product(self):
765777
766778
767779class TestQuestionnaireCrossEngagementIDOR (DojoTestCase ):
768- """H1 #3571957: Survey/questionnaire endpoints must reject
769- a survey belonging to a different engagement than the eid in the URL."""
780+
781+ """
782+ H1 #3571957: Survey/questionnaire endpoints must reject
783+ a survey belonging to a different engagement than the eid in the URL.
784+ """
770785
771786 @classmethod
772787 def setUpTestData (cls ):
@@ -779,7 +794,7 @@ def setUpTestData(cls):
779794 )
780795 cls .user = Dojo_User .objects .create_user (
781796 username = "survey_idor_owner" ,
782- password = "testTEST1234!@#$" ,
797+ password = "testTEST1234!@#$" , # noqa: S106
783798 is_active = True ,
784799 )
785800 Product_Member .objects .create (
@@ -814,7 +829,7 @@ def setUpTestData(cls):
814829
815830 def _login (self ):
816831 client = Client ()
817- client .login (username = "survey_idor_owner" , password = "testTEST1234!@#$" )
832+ client .login (username = "survey_idor_owner" , password = "testTEST1234!@#$" ) # noqa: S106
818833 return client
819834
820835 def test_view_questionnaire_cross_engagement (self ):
@@ -855,8 +870,11 @@ def test_view_questionnaire_same_engagement(self):
855870
856871
857872class TestFindingTemplatesGlobalPermission (DojoTestCase ):
858- """H1 #3577363: find_template_to_apply must require global Finding_Edit
859- permission, not just product-level Finding_Edit."""
873+
874+ """
875+ H1 #3577363: find_template_to_apply must require global Finding_Edit
876+ permission, not just product-level Finding_Edit.
877+ """
860878
861879 @classmethod
862880 def setUpTestData (cls ):
@@ -871,7 +889,7 @@ def setUpTestData(cls):
871889 # Product-level writer (no global permission)
872890 cls .product_writer = Dojo_User .objects .create_user (
873891 username = "template_test_writer" ,
874- password = "testTEST1234!@#$" ,
892+ password = "testTEST1234!@#$" , # noqa: S106
875893 is_active = True ,
876894 )
877895 Product_Member .objects .create (
@@ -881,7 +899,7 @@ def setUpTestData(cls):
881899 # Superuser (has global permissions)
882900 cls .superuser = Dojo_User .objects .create_user (
883901 username = "template_test_super" ,
884- password = "testTEST1234!@#$" ,
902+ password = "testTEST1234!@#$" , # noqa: S106
885903 is_active = True ,
886904 is_superuser = True ,
887905 )
@@ -917,7 +935,7 @@ def setUpTestData(cls):
917935 def test_product_writer_cannot_access_find_template (self ):
918936 """Product-level Writer without global permission should be denied."""
919937 client = Client ()
920- client .login (username = "template_test_writer" , password = "testTEST1234!@#$" )
938+ client .login (username = "template_test_writer" , password = "testTEST1234!@#$" ) # noqa: S106
921939 url = reverse ("find_template_to_apply" , args = (self .finding .id ,))
922940 response = client .get (url )
923941 # PermissionDenied raised; custom handler403 returns 400 (DD bug)
@@ -926,15 +944,18 @@ def test_product_writer_cannot_access_find_template(self):
926944 def test_superuser_can_access_find_template (self ):
927945 """Superuser (implicit global permission) should be able to access."""
928946 client = Client ()
929- client .login (username = "template_test_super" , password = "testTEST1234!@#$" )
947+ client .login (username = "template_test_super" , password = "testTEST1234!@#$" ) # noqa: S106
930948 url = reverse ("find_template_to_apply" , args = (self .finding .id ,))
931949 response = client .get (url )
932950 self .assertEqual (response .status_code , 200 )
933951
934952
935953class TestJiraEpicBFLA (DojoTestCase ):
936- """H1 #3577193: update_jira_epic must enforce Engagement_Edit permission,
937- not just IsAuthenticated. Reader role should be denied."""
954+
955+ """
956+ H1 #3577193: update_jira_epic must enforce Engagement_Edit permission,
957+ not just IsAuthenticated. Reader role should be denied.
958+ """
938959
939960 @classmethod
940961 def setUpTestData (cls ):
@@ -949,12 +970,12 @@ def setUpTestData(cls):
949970
950971 cls .reader_user = Dojo_User .objects .create_user (
951972 username = "jira_epic_reader" ,
952- password = "testTEST1234!@#$" ,
973+ password = "testTEST1234!@#$" , # noqa: S106
953974 is_active = True ,
954975 )
955976 cls .writer_user = Dojo_User .objects .create_user (
956977 username = "jira_epic_writer" ,
957- password = "testTEST1234!@#$" ,
978+ password = "testTEST1234!@#$" , # noqa: S106
958979 is_active = True ,
959980 )
960981
@@ -986,8 +1007,10 @@ def test_reader_cannot_update_jira_epic(self):
9861007 self .assertIn (response .status_code , [403 , 404 ])
9871008
9881009 def test_writer_allowed_update_jira_epic (self ):
989- """Writer role should be allowed to POST to update_jira_epic
990- (may fail at Jira level, but not at permission level)."""
1010+ """
1011+ Writer role should be allowed to POST to update_jira_epic
1012+ (may fail at Jira level, but not at permission level).
1013+ """
9911014 client = self ._client_for_user (self .writer_user )
9921015 url = reverse ("engagement-update-jira-epic" , args = (self .engagement .id ,))
9931016 response = client .post (url , data = {}, format = "json" )
0 commit comments