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 http_status_code was risen inside :meth:`robottelo.api.assertions.assert_api_not_raises` block. """ with pytest.raises(AssertionError): with assert_api_not_raises(HTTPError, expected_value=404): fake_404_response()
def test_negative_wrong_status_code_context_manager(): """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` block. """ with pytest.raises(HTTPError): with assert_api_not_raises(HTTPError, expected_value=405): fake_404_response()
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_positive_regex_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_regex` block and expected pattern was found in exception message. """ with pytest.raises(AssertionError): with assert_api_not_raises_regex(HTTPError, pattern): fake_404_response()
def test_negative_regex_wrong_pattern_exc_correct_status_code_manager(): """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): with assert_api_not_raises_regex(ZeroDivisionError, 'foo', expected_value=404): fake_404_response()
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_raised_context_manager_with_status_code(): """Assert that the test will fail (not marked as errored) in case expected exception was risen inside :meth:`robottelo.api.assert_api_not_raises_regex` block and http_status_code altogether with regex pattern match expected ones. """ with pytest.raises(AssertionError): with assert_api_not_raises_regex(HTTPError, pattern, expected_value=404): fake_404_response()