@@ -526,59 +526,45 @@ def test_create_scan_example(self):
526
526
527
527
@needscredentials
528
528
def test_create_control_library_example (self ):
529
- """
530
- create_control_library request example
531
- """
532
- try :
533
- global control_library_id_link
534
-
535
- print ('\n create_control_library() result:' )
536
-
537
- # begin-create_control_library
538
-
539
- assessment_prototype_model = {
540
- 'assessment_id' : 'rule-d1bd9f3f-bee1-46c5-9533-da8bba9eed4e' ,
541
- 'assessment_description' : 'This rule will check on regulation' ,
542
- }
543
-
544
- control_specification_prototype_model = {
545
- 'component_id' : 'apprapp' ,
546
- 'environment' : 'ibm-cloud' ,
547
- 'control_specification_description' : 'This field is used to describe a control specification' ,
548
- 'assessments' : [assessment_prototype_model ],
549
- }
529
+ global control_library_id_link
550
530
551
- control_doc_model = {
552
- }
553
-
554
- control_prototype_model = {
555
- 'control_name' : 'security' ,
556
- 'control_description' : 'This is a description of a control' ,
557
- 'control_category' : 'test-control' ,
558
- 'control_requirement' : True ,
559
- 'control_parent' : 'testString' ,
560
- 'control_specifications' : [control_specification_prototype_model ],
561
- 'control_docs' : control_doc_model ,
562
- 'status' : 'disabled' ,
563
- }
564
-
565
- response = security_and_compliance_center_api_service .create_control_library (
566
- instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' ,
567
- control_library_name = 'custom control library from SDK' ,
568
- control_library_description = 'This is a custom control library made from the SDK test framework' ,
569
- control_library_type = 'custom' ,
570
- control_library_version = '0.0.1' ,
571
- controls = [control_prototype_model ],
572
- )
573
- control_library = response .get_result ()
531
+ # Construct a dict representation of a AssessmentPrototype model
532
+ assessment_prototype_model = {
533
+ 'assessment_id' : 'rule-d1bd9f3f-bee1-46c5-9533-da8bba9eed4e' ,
534
+ 'assessment_description' : 'This rule will check on regulation' ,
535
+ }
536
+ # Construct a dict representation of a ControlSpecificationPrototype model
537
+ control_specification_prototype_model = {
538
+ 'component_id' : 'apprapp' ,
539
+ 'environment' : 'ibm-cloud' ,
540
+ 'control_specification_description' : 'This field is used to describe a control specification' ,
541
+ 'assessments' : [assessment_prototype_model ],
542
+ }
543
+ # Construct a dict representation of a ControlPrototype model
544
+ control_prototype_model = {
545
+ 'control_name' : 'security' ,
546
+ 'control_description' : 'This is a description of a control' ,
547
+ 'control_category' : 'test-control' ,
548
+ 'control_requirement' : True ,
549
+ 'control_specifications' : [control_specification_prototype_model ],
550
+ 'status' : 'disabled' ,
551
+ }
574
552
575
- print (json .dumps (control_library , indent = 2 ))
553
+ response = security_and_compliance_center_api_service .create_control_library (
554
+ instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' ,
555
+ control_library_name = 'custom control library from SDK' ,
556
+ control_library_description = 'This is a custom control library made from the SDK test framework' ,
557
+ control_library_type = 'custom' ,
558
+ control_library_version = '0.0.1' ,
559
+ controls = [control_prototype_model ],
560
+ account_id = account_id_for_report_link ,
561
+ )
576
562
577
- # end-create_control_library
563
+ assert response .get_status_code () == 201
564
+ control_library = response .get_result ()
565
+ assert control_library is not None
578
566
579
- control_library_id_link = control_library ['id' ]
580
- except ApiException as e :
581
- pytest .fail (str (e ))
567
+ control_library_id_link = control_library ['id' ]
582
568
583
569
@needscredentials
584
570
def test_list_control_libraries_example (self ):
0 commit comments