コード例 #1
0
def test_validate_get_int_max_incident_error(string_input):
    """
    Scenario: Validate and convert string max_results to integer.

    Given:
    - Invalid page size.

    When:
    - Validating max_results at a time of fetched incident

    Then:
    - Ensure if page_size is not in range it returns error.
    """
    from GoogleCloudSCC import validate_get_int, MAX_PAGE_SIZE

    with pytest.raises(ValueError, match=ERROR_MESSAGES["MAX_INCIDENT_ERROR"]):
        validate_get_int(string_input, ERROR_MESSAGES["MAX_INCIDENT_ERROR"], MAX_PAGE_SIZE)
コード例 #2
0
def test_validate_get_int_success():
    """
    Scenario: Validate and convert string max_results to integer.

    Given:
    - valid page size.

    When:
    - Validating max_results.

    Then:
    - Ensure if max_results is valid.
    """
    from GoogleCloudSCC import validate_get_int

    max_results = "9"

    return_value = validate_get_int(max_results, ERROR_MESSAGES["MAX_INCIDENT_ERROR"])
    assert return_value == 9