def test_negative_regex_wrong_exception_raised_callable(): """Assert that unexpected exception with expected pattern won't be handled and passed through to the test from :meth:`robottelo.api.assertions.assert_api_not_raises_regex` call. """ with pytest.raises(ZeroDivisionError): assert_api_not_raises_regex(HTTPError, pattern, 1 / 0)
def test_positive_regex_raised_callable(): """Assert that the test will fail (not marked as errored) in case expected exception was risen inside :meth:`robottelo.api.assertions.assert_api_not_raises_regex` call and expected pattern was found in exception message. """ with pytest.raises(AssertionError): assert_api_not_raises_regex(HTTPError, pattern, fake_404_response)
def test_negative_regex_wrong_pattern_exc_correct_status_code_callable(): """Assert that unexpected exception with invalid patter but expected status code won't be handled and passed through to the test from :meth:`robottelo.api.assertions.assert_api_not_raises_regex` call. """ with pytest.raises(HTTPError): assert_api_not_raises_regex(ZeroDivisionError, 'foo', fake_404_response, expected_value=404)
def test_negative_regex_wrong_status_code_callable(): """Assert that expected exception with valid pattern but unexpected http_status_code won't be handled and passed through to the test from :meth:`robottelo.api.assertions.assert_api_not_raises_regex` call. """ with pytest.raises(HTTPError): assert_api_not_raises_regex(HTTPError, pattern, fake_404_response, expected_value=405)
def test_positive_regex_raised_callable_with_status_code(): """Assert that the test will fail (not marked as errored) in case expected exception was risen inside :meth:`robottelo.api.assertions.assert_api_not_raises_regex` call and http_status_code altogether with regex pattern match expected ones. """ with pytest.raises(AssertionError): assert_api_not_raises_regex(HTTPError, pattern, fake_404_response, expected_value=404)
def test_negative_regex_wrong_pattern_status_code_correct_exc_manager(): """Assert that expected exception with unexpected status code and pattern won't be handled and passed through to the test from :meth:`robottelo.api.assertions.assert_api_not_raises_regex` block. """ with pytest.raises(HTTPError): with assert_api_not_raises_regex(HTTPError, 'foo', expected_value=405): fake_404_response()
def test_negative_regex_wrong_exception_raised_context_manager(): """Assert that unexpected exception with expected pattern won't be handled and passed through to the test from :meth:`robottelo.api.assertions.assert_api_not_raises_regex` block. """ with pytest.raises(ValueError): with assert_api_not_raises_regex(HTTPError, pattern): raise ValueError
def test_negative_regex_wrong_exception_and_status_code_context_manager(): """Assert that unexpected exception with unexpected status code but expected pattern won't be handled and passed through to the test from :meth:`robottelo.api.assert_api_not_raises_regex` block. """ with pytest.raises(HTTPError): with assert_api_not_raises_regex(ZeroDivisionError, pattern, expected_value=405): fake_404_response()
def test_positive_regex_not_raised_context_manager(): """Assert that the test won't fail in case exception was not risen inside :meth:`robottelo.api.assertions.assert_api_not_raises_regex` block. """ with assert_api_not_raises_regex(HTTPError, pattern): fake_200_response()
def test_positive_regex_not_raised_callable(): """Assert that the test won't fail in case exception was not risen inside :meth:`robottelo.api.assertions.assert_api_not_raises_regex` call. """ assert_api_not_raises_regex(HTTPError, pattern, fake_200_response)