1414from ydb_mcp .server import AUTH_MODE_ANONYMOUS , AUTH_MODE_LOGIN_PASSWORD
1515
1616# Suppress the utcfromtimestamp deprecation warning from the YDB library
17- warnings .filterwarnings (
18- "ignore" , message = "datetime.datetime.utcfromtimestamp.*" , category = DeprecationWarning
19- )
17+ warnings .filterwarnings ("ignore" , message = "datetime.datetime.utcfromtimestamp.*" , category = DeprecationWarning )
2018
2119# Table name used for tests - using timestamp to avoid conflicts
2220TEST_TABLE = f"mcp_integration_test_{ int (time .time ())} "
@@ -58,12 +56,7 @@ async def test_login_password_authentication(mcp_server):
5856 # Verify we can execute a query
5957 result = await call_mcp_tool (mcp_server , "ydb_query" , sql = "SELECT 1+1 as result" )
6058 # Parse the JSON from the 'text' field if present
61- if (
62- isinstance (result , list )
63- and len (result ) > 0
64- and isinstance (result [0 ], dict )
65- and "text" in result [0 ]
66- ):
59+ if isinstance (result , list ) and len (result ) > 0 and isinstance (result [0 ], dict ) and "text" in result [0 ]:
6760 parsed = json .loads (result [0 ]["text" ])
6861 else :
6962 parsed = result
@@ -80,12 +73,7 @@ async def test_login_password_authentication(mcp_server):
8073 # Query should fail with auth error
8174 result = await call_mcp_tool (mcp_server , "ydb_query" , sql = "SELECT 1+1 as result" )
8275 # Parse the JSON from the 'text' field if present
83- if (
84- isinstance (result , list )
85- and len (result ) > 0
86- and isinstance (result [0 ], dict )
87- and "text" in result [0 ]
88- ):
76+ if isinstance (result , list ) and len (result ) > 0 and isinstance (result [0 ], dict ) and "text" in result [0 ]:
8977 parsed = json .loads (result [0 ]["text" ])
9078 else :
9179 parsed = result
@@ -111,9 +99,9 @@ async def test_login_password_authentication(mcp_server):
11199 # Allow empty error message as valid
112100 pass
113101 else :
114- assert any (
115- keyword in error_msg for keyword in all_keywords
116- ), f"Unexpected error message: { parsed . get ( 'error' ) } "
102+ assert any (keyword in error_msg for keyword in all_keywords ), (
103+ f"Unexpected error message: { parsed . get ( 'error' ) } "
104+ )
117105
118106 finally :
119107 # Switch back to anonymous auth to clean up (fixture will handle final state reset)
0 commit comments