def test_negative_wrong_status_code_callable(): """Assert that expected exception with unexpected http_status_code won't be handled and passed through to the test from :meth:`robottelo.api.assertions.assert_api_not_raises` call. """ with pytest.raises(HTTPError): assert_api_not_raises(HTTPError, fake_404_response, expected_value=405)
def test_positive_raised_callable_with_status_code(): """Assert that the test will fail (not marked as errored) in case expected exception with expected http_status_code was risen inside :meth:`robottelo.api.assertions.assert_api_not_raises` call. """ with pytest.raises(AssertionError): assert_api_not_raises(HTTPError, fake_404_response, expected_value=404)
def test_negative_wrong_exception_raised_context_manager(): """Assert that unexpected exception won't be handled and passed through to the test from :meth:`robottelo.api.assertions.assert_api_not_raises` block. """ with pytest.raises(ValueError): with assert_api_not_raises(HTTPError): raise ValueError
def test_positive_raised_context_manager(): """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` block. """ with pytest.raises(AssertionError): with assert_api_not_raises(HTTPError): fake_404_response()
def test_negative_wrong_exc_correct_status_code_context_manager(): """Assert that unexpected exception with expected status code won't be handled and passed through to the test from :meth:`robottelo.api.assertions.assert_api_not_raises` block. """ with pytest.raises(HTTPError): with assert_api_not_raises(ZeroDivisionError, expected_value=404): fake_404_response()
def test_negative_wrong_exception_raised_callable(): """Assert that unexpected exception won't be handled and passed through to the test from :meth:`robottelo.api.assertions.assert_api_not_raises` call. """ with pytest.raises(ZeroDivisionError): assert_api_not_raises(HTTPError, 1 / 0)
def test_positive_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` block. """ with assert_api_not_raises(HTTPError): fake_200_response()
def test_positive_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` call. """ assert_api_not_raises(HTTPError, fake_200_response)