Skip to content

Commit 8ca84a6

Browse files
authored
test(FIR-49477): Fix error check for SA with no user (#458)
1 parent 54c7778 commit 8ca84a6

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

tests/integration/dbapi/async/V2/test_errors_async.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async def test_account_no_user(
3838
"""Connection properly reacts to account that doesn't have
3939
a user attached to it."""
4040

41-
with raises(AccountNotFoundOrNoAccessError) as exc_info:
41+
with raises((AccountNotFoundOrNoAccessError, FireboltStructuredError)) as exc_info:
4242
async with await connect(
4343
database=database_name,
4444
auth=auth_no_user,
@@ -50,8 +50,12 @@ async def test_account_no_user(
5050
) as connection:
5151
await connection.cursor().execute("show tables")
5252

53-
assert f"'{account_name}' does not exist" in str(
54-
exc_info.value
53+
assert str(exc_info.value).startswith(
54+
f"Account '{account_name}' does not exist"
55+
) or (
56+
# Caching on the backend may cause this error instead
57+
f"Database '{database_name}' does not exist or not authorized."
58+
in str(exc_info.value)
5559
), "Invalid account error message."
5660

5761

tests/integration/dbapi/sync/V2/test_errors.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_account_no_user(
3636
api_endpoint: str,
3737
) -> None:
3838
"""Connection properly reacts to invalid account error."""
39-
with raises(AccountNotFoundOrNoAccessError) as exc_info:
39+
with raises((AccountNotFoundOrNoAccessError, FireboltStructuredError)) as exc_info:
4040
with connect(
4141
database=database_name,
4242
auth=auth_no_user,
@@ -50,6 +50,10 @@ def test_account_no_user(
5050

5151
assert str(exc_info.value).startswith(
5252
f"Account '{account_name}' does not exist"
53+
) or (
54+
# Caching on the backend may cause this error instead
55+
f"Database '{database_name}' does not exist or not authorized."
56+
in str(exc_info.value)
5357
), "Invalid account error message."
5458

5559

0 commit comments

Comments
 (0)