Skip to content

Commit 315c8d3

Browse files
committed
rename path to backends instead of backend
1 parent ae32595 commit 315c8d3

File tree

10 files changed

+11
-10
lines changed

10 files changed

+11
-10
lines changed

aws_advanced_python_wrapper/sql_alchemy_connection_provider.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def accepts_host_info(self, host_info: HostInfo, props: Properties) -> bool:
8888
if self._accept_url_func:
8989
return self._accept_url_func(host_info, props)
9090
url_type = SqlAlchemyPooledConnectionProvider._rds_utils.identify_rds_type(host_info.host)
91-
return url_type in (RdsUrlType.RDS_INSTANCE, RdsUrlType.RDS_WRITER_CLUSTER)
91+
return RdsUrlType.RDS_INSTANCE == url_type
9292

9393
def accepts_strategy(self, role: HostRole, strategy: str) -> bool:
9494
return strategy == SqlAlchemyPooledConnectionProvider._LEAST_CONNECTIONS or strategy in self._accepted_strategies
@@ -137,6 +137,7 @@ def connect(
137137

138138
if queue_pool is None:
139139
raise AwsWrapperError(Messages.get_formatted("SqlAlchemyPooledConnectionProvider.PoolNone", host_info.url))
140+
140141
return queue_pool.connect()
141142

142143
# The pool key should always be retrieved using this method, because the username

tests/integration/container/tortoise/test_tortoise_config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async def setup_tortoise_dict_config(self, conn_utils):
4848
config = {
4949
"connections": {
5050
"default": {
51-
"engine": "aws_advanced_python_wrapper.tortoise.backend.mysql",
51+
"engine": "aws_advanced_python_wrapper.tortoise.backends.mysql",
5252
"credentials": {
5353
"host": conn_utils.writer_cluster_host,
5454
"port": conn_utils.port,
@@ -87,7 +87,7 @@ async def setup_tortoise_multi_db(self, conn_utils):
8787
config = {
8888
"connections": {
8989
"default": {
90-
"engine": "aws_advanced_python_wrapper.tortoise.backend.mysql",
90+
"engine": "aws_advanced_python_wrapper.tortoise.backends.mysql",
9191
"credentials": {
9292
"host": conn_utils.writer_cluster_host,
9393
"port": conn_utils.port,
@@ -98,7 +98,7 @@ async def setup_tortoise_multi_db(self, conn_utils):
9898
}
9999
},
100100
"second_db": {
101-
"engine": "aws_advanced_python_wrapper.tortoise.backend.mysql",
101+
"engine": "aws_advanced_python_wrapper.tortoise.backends.mysql",
102102
"credentials": {
103103
"host": conn_utils.writer_cluster_host,
104104
"port": conn_utils.port,
@@ -149,7 +149,7 @@ async def setup_tortoise_with_router(self, conn_utils):
149149
config = {
150150
"connections": {
151151
"default": {
152-
"engine": "aws_advanced_python_wrapper.tortoise.backend.mysql",
152+
"engine": "aws_advanced_python_wrapper.tortoise.backends.mysql",
153153
"credentials": {
154154
"host": conn_utils.writer_cluster_host,
155155
"port": conn_utils.port,

tests/unit/test_tortoise_mysql_client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from tortoise.exceptions import (DBConnectionError, IntegrityError,
2020
OperationalError, TransactionManagementError)
2121

22-
from aws_advanced_python_wrapper.tortoise.backend.mysql.client import (
22+
from aws_advanced_python_wrapper.tortoise.backends.mysql.client import (
2323
AwsMySQLClient, TransactionWrapper, _gen_savepoint_name,
2424
translate_exceptions)
2525

@@ -117,7 +117,7 @@ async def test_create_connection_success(self):
117117
connection_name="test_conn"
118118
)
119119

120-
with patch('aws_advanced_python_wrapper.tortoise.backend.mysql.client.logger'):
120+
with patch('aws_advanced_python_wrapper.tortoise.backends.mysql.client.logger'):
121121
await client.create_connection(with_db=True)
122122

123123
assert client._template["user"] == "test_user"
@@ -177,7 +177,7 @@ async def test_execute_insert(self):
177177
mock_connection.cursor.return_value.__aexit__ = AsyncMock()
178178
mock_cursor.execute = AsyncMock()
179179

180-
with patch('aws_advanced_python_wrapper.tortoise.backend.mysql.client.logger'):
180+
with patch('aws_advanced_python_wrapper.tortoise.backends.mysql.client.logger'):
181181
result = await client.execute_insert("INSERT INTO test VALUES (?)", ["value"])
182182

183183
assert result == 123
@@ -208,7 +208,7 @@ async def test_execute_many_with_transactions(self):
208208
with patch.object(client, '_execute_many_with_transaction') as mock_execute_many_tx:
209209
mock_execute_many_tx.return_value = None
210210

211-
with patch('aws_advanced_python_wrapper.tortoise.backend.mysql.client.logger'):
211+
with patch('aws_advanced_python_wrapper.tortoise.backends.mysql.client.logger'):
212212
await client.execute_many("INSERT INTO test VALUES (?)", [["val1"], ["val2"]])
213213

214214
mock_execute_many_tx.assert_called_once_with(
@@ -240,7 +240,7 @@ async def test_execute_query(self):
240240
mock_cursor.execute = AsyncMock()
241241
mock_cursor.fetchall = AsyncMock(return_value=[(1, "test"), (2, "test2")])
242242

243-
with patch('aws_advanced_python_wrapper.tortoise.backend.mysql.client.logger'):
243+
with patch('aws_advanced_python_wrapper.tortoise.backends.mysql.client.logger'):
244244
rowcount, results = await client.execute_query("SELECT * FROM test")
245245

246246
assert rowcount == 2

0 commit comments

Comments
 (0)