def test_publish_last_scan_results_to_management_and_orchestration_by_project_id(
):
    project_id = get_project_id()
    scan_api = ScansAPI()
    policy_finding_response = scan_api.publish_last_scan_results_to_management_and_orchestration_by_project_id(
        project_id)
    assert policy_finding_response is not None
def test_get_sast_scan_details_by_scan_id():
    project_id = get_project_id()

    scan_api = ScansAPI()
    scan_id = scan_api.get_last_scan_id_of_a_project(project_id)
    scan = scan_api.get_sast_scan_details_by_scan_id(scan_id)
    assert scan is not None
def test_get_the_publish_last_scan_results_to_management_and_orchestration_status(
):
    project_id = get_project_id()
    scan_api = ScansAPI()
    policy_finding_status = scan_api.get_the_publish_last_scan_results_to_management_and_orchestration_status(
        project_id)
    assert policy_finding_status is not None
def test_get_short_vulnerability_description_for_a_scan_result():
    scan_id = 1000006
    path_id = 1
    scan_api = ScansAPI()

    short_description = scan_api.get_short_vulnerability_description_for_a_scan_result(
        scan_id=scan_id, path_id=path_id)
    assert short_description is not None
def test_add_or_update_a_comment_by_scan_id():
    project_id = get_project_id()

    scan_api = ScansAPI()
    scan_id = scan_api.get_last_scan_id_of_a_project(project_id)
    result = scan_api.add_or_update_a_comment_by_scan_id(
        scan_id, "updated scan")
    assert result is True
def test_assign_ticket_to_scan_results():
    scan_api = ScansAPI()

    results_id = None
    ticket_id = None
    is_successful = scan_api.assign_ticket_to_scan_results(
        results_id, ticket_id)
    assert is_successful is True
    pass
def test_get_all_scan_details_in_queue():
    project_id = get_project_id()

    scan_api = ScansAPI()
    # scan = scan_api.create_new_scan(project_id, is_incremental=False, is_public=True, force_scan=True,
    #                                 comment="scan from REST API")
    time.sleep(4)
    all_scan_details_in_queue = scan_api.get_all_scan_details_in_queue()
    assert all_scan_details_in_queue is not None
def test_create_new_scan():
    project_id = get_project_id()

    scan_api = ScansAPI()
    scan = scan_api.create_new_scan(project_id,
                                    is_incremental=False,
                                    is_public=True,
                                    force_scan=True,
                                    comment="scan from REST API")
    assert scan is not None
def test_define_sast_scan_scheduling_settings():
    project_name = "git-http"
    project_id = get_project_id(project_name)

    scan_api = ScansAPI()
    schedule_type = "None"
    schedule_days = []
    schedule_time = ""
    result = scan_api.define_sast_scan_scheduling_settings(
        project_id, schedule_type, schedule_days, schedule_time)
    assert result is True
def test_update_queued_scan_status_by_scan_id():
    project_id = get_project_id()

    scan_api = ScansAPI()
    scan = scan_api.create_new_scan(project_id,
                                    is_incremental=False,
                                    is_public=True,
                                    force_scan=True,
                                    comment="scan from REST API")
    time.sleep(5)
    result = scan_api.update_queued_scan_status_by_scan_id(
        scan_id=scan.id, status_id=1, status_value="Canceled")
    assert result is True
def test_update_sast_scan_settings():
    project_id = get_project_id()
    scan_api = ScansAPI()
    project_api = ProjectsAPI()
    preset_id = project_api.get_preset_id_by_name("Checkmarx Default")
    engine_configuration_id = 1
    post_scan_action_id = None
    failed_scan_emails = ["*****@*****.**"]
    before_scan_emails = ["*****@*****.**"]
    after_scan_emails = ["*****@*****.**"]
    scan_settings = scan_api.update_sast_scan_settings(
        project_id, preset_id, engine_configuration_id, post_scan_action_id,
        failed_scan_emails, before_scan_emails, after_scan_emails)
    assert scan_settings is not None
def test_register_scan_report():
    project_id = get_project_id()

    scan_api = ScansAPI()
    scan_id = scan_api.get_last_scan_id_of_a_project(project_id)
    scan = scan_api.get_sast_scan_details_by_scan_id(scan_id)
    scan_id = scan.id
    report_type = "XML"
    scan_report = scan_api.register_scan_report(scan_id, report_type)
    assert scan_report is not None

    # test_get_report_status_by_id():
    report_id = scan_report.report_id
    report_status = scan_api.get_report_status_by_id(report_id)
    assert report_status is not None

    # test_get_report_by_id():
    report_content = scan_api.get_report_by_id(report_id)
    assert report_content is not None
def test_get_statistics_results_by_scan_id():
    project_id = get_project_id()
    scan_api = ScansAPI()
    scan_id = scan_api.get_last_scan_id_of_a_project(project_id)
    statistics = scan_api.get_statistics_results_by_scan_id(scan_id)
    assert statistics is not None
def test_delete_scan_by_scan_id():
    project_id = get_project_id()
    scan_api = ScansAPI()
    scan_id = scan_api.get_last_scan_id_of_a_project(project_id)
    result = scan_api.delete_scan_by_scan_id(scan_id)
    assert result is True
def test_get_scan_settings_by_project_id():
    project_id = get_project_id()

    scan_api = ScansAPI()
    scan_settings = scan_api.get_scan_settings_by_project_id(project_id)
    assert scan_settings is not None
def test_get_last_scan_id_of_a_project():
    project_id = get_project_id()

    scan_api = ScansAPI()
    scan_id = scan_api.get_last_scan_id_of_a_project(project_id)
    assert scan_id is not None
def test_get_all_scans_for_project():
    project_id = get_project_id()

    scan_api = ScansAPI()
    all_scans = scan_api.get_all_scans_for_project(project_id)
    assert all_scans is not None