示例#1
0
def test_positive_raised_context_manager_with_status_code():
    """Assert that the test will fail (not marked as errored) in case
    expected exception with expected cli_return_code was risen inside
    pure pytest block.
    """
    with pytest.raises(AssertionError):
        with assert_cli_not_raises(CLIReturnCodeError, expected_value=128):
            fake_128_return_code()
示例#2
0
def test_negative_wrong_status_code_context_manager():
    """Assert that expected exception with unexpected cli_return_code
    status code won't be handled and passed through to the test from
    pure pytest block.
    """
    with pytest.raises(CLIReturnCodeError):
        with assert_cli_not_raises(CLIReturnCodeError, expected_value=129):
            fake_128_return_code()
示例#3
0
def test_negative_wrong_status_code_context_manager():
    """Assert that expected exception with unexpected cli_return_code
    status code won't be handled and passed through to the test from
    pure pytest block.
    """
    with pytest.raises(CLIReturnCodeError):
        with assert_cli_not_raises(CLIReturnCodeError, expected_value=129):
            fake_128_return_code()
示例#4
0
def test_positive_raised_context_manager_with_status_code():
    """Assert that the test will fail (not marked as errored) in case
    expected exception with expected cli_return_code was risen inside
    pure pytest block.
    """
    with pytest.raises(AssertionError):
        with assert_cli_not_raises(CLIReturnCodeError, expected_value=128):
            fake_128_return_code()
示例#5
0
def test_regex_negative_wrong_status_code_context_manager():
    """Assert that expected exception with valid pattern but unexpected
    cli_return_code won't be handled and passed through to the test from
    `robottelo.cli.assertions.assert_cli_not_raises_regex` block.
    """
    with pytest.raises(CLIReturnCodeError):
        with assert_cli_not_raises_regex(CLIReturnCodeError,
                                         pattern,
                                         expected_value=129):
            fake_128_return_code()
示例#6
0
def test_regex_positive_raised_context_manager_with_status_code():
    """Assert that the test will fail (not marked as errored) in case
    expected exception was risen inside
    `robottelo.cli.assertions.assert_cli_not_raises_regex` block and
    cli_return_code altogether with regex pattern match expected ones.
    """
    with pytest.raises(AssertionError):
        with assert_cli_not_raises_regex(CLIReturnCodeError, pattern,
                                         expected_value=128):
            fake_128_return_code()
示例#7
0
def test_regex_positive_raised_context_manager_with_status_code():
    """Assert that the test will fail (not marked as errored) in case
    expected exception was risen inside
    `robottelo.cli.assertions.assert_cli_not_raises_regex` block and
    cli_return_code altogether with regex pattern match expected ones.
    """
    with pytest.raises(AssertionError):
        with assert_cli_not_raises_regex(CLIReturnCodeError,
                                         pattern,
                                         expected_value=128):
            fake_128_return_code()
示例#8
0
def test_regex_negative_wrong_status_code_context_manager():
    """Assert that expected exception with valid pattern but unexpected
    cli_return_code won't be handled and passed through to the test from
    `robottelo.cli.assertions.assert_cli_not_raises_regex` block.
    """
    with pytest.raises(CLIReturnCodeError):
        with assert_cli_not_raises_regex(
            CLIReturnCodeError,
            pattern,
            expected_value=129,
        ):
            fake_128_return_code()