diff --git a/tests/integration/dbapi/async/V2/test_errors_async.py b/tests/integration/dbapi/async/V2/test_errors_async.py index 39a78156671..64294afc942 100644 --- a/tests/integration/dbapi/async/V2/test_errors_async.py +++ b/tests/integration/dbapi/async/V2/test_errors_async.py @@ -38,7 +38,7 @@ async def test_account_no_user( """Connection properly reacts to account that doesn't have a user attached to it.""" - with raises(AccountNotFoundOrNoAccessError) as exc_info: + with raises((AccountNotFoundOrNoAccessError, FireboltStructuredError)) as exc_info: async with await connect( database=database_name, auth=auth_no_user, @@ -50,8 +50,12 @@ async def test_account_no_user( ) as connection: await connection.cursor().execute("show tables") - assert f"'{account_name}' does not exist" in str( - exc_info.value + assert str(exc_info.value).startswith( + f"Account '{account_name}' does not exist" + ) or ( + # Caching on the backend may cause this error instead + f"Database '{database_name}' does not exist or not authorized." + in str(exc_info.value) ), "Invalid account error message." diff --git a/tests/integration/dbapi/sync/V2/test_errors.py b/tests/integration/dbapi/sync/V2/test_errors.py index f93a9e7b586..27a210b9912 100644 --- a/tests/integration/dbapi/sync/V2/test_errors.py +++ b/tests/integration/dbapi/sync/V2/test_errors.py @@ -36,7 +36,7 @@ def test_account_no_user( api_endpoint: str, ) -> None: """Connection properly reacts to invalid account error.""" - with raises(AccountNotFoundOrNoAccessError) as exc_info: + with raises((AccountNotFoundOrNoAccessError, FireboltStructuredError)) as exc_info: with connect( database=database_name, auth=auth_no_user, @@ -50,6 +50,10 @@ def test_account_no_user( assert str(exc_info.value).startswith( f"Account '{account_name}' does not exist" + ) or ( + # Caching on the backend may cause this error instead + f"Database '{database_name}' does not exist or not authorized." + in str(exc_info.value) ), "Invalid account error message."