diff --git a/tests/adapters/repository/test_accounts.py b/tests/adapters/repository/test_accounts.py new file mode 100644 index 0000000000000000000000000000000000000000..fb91068ca927ced6fb51084d25128d6a75824018 --- /dev/null +++ b/tests/adapters/repository/test_accounts.py @@ -0,0 +1,29 @@ +# Copyright 2021 Vincent Texier <vit@free.fr> +# +# This software is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +from tikka.domains.application import Application +from tikka.domains.entities.account import Account + + +def test_accounts_list(application: Application, account: Account): + """ + Test list accounts + + :param application: Application instance + :param account: Account instance + :return: + """ + application.accounts.add(account) + assert len(application.accounts.get_list()) > 0 diff --git a/tests/adapters/repository/test_indexers.py b/tests/adapters/repository/test_indexers.py new file mode 100644 index 0000000000000000000000000000000000000000..8b61c517e9b142904b1be687417042da1d5566ba --- /dev/null +++ b/tests/adapters/repository/test_indexers.py @@ -0,0 +1,27 @@ +# Copyright 2021 Vincent Texier <vit@free.fr> +# +# This software is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +from tikka.domains.application import Application + + +def test_indexers_list(application: Application): + """ + + + :param application: Application instance + :param account: Account instance + :return: + """ + assert len(application.repository.indexers.list()) > 0 diff --git a/tikka/adapters/repository/accounts.py b/tikka/adapters/repository/accounts.py index c4128d6d96b1c989d9af9bcf16b2bcde9c5e7b6a..872e3a3f20311dec946f9a72c087f261bf405491 100644 --- a/tikka/adapters/repository/accounts.py +++ b/tikka/adapters/repository/accounts.py @@ -30,8 +30,6 @@ from tikka.interfaces.adapters.repository.db_repository import DBRepositoryInter TABLE_NAME = "accounts" -# config sql with ? as param style -Flavor.set(Flavor(paramstyle="qmark")) # create sql table wrapper sql_accounts_table = Table(TABLE_NAME) @@ -104,7 +102,10 @@ class DBAccountsRepository(AccountsRepositoryInterface, DBRepositoryInterface): return And((a, b)) if len(conditions) > 0: - sql_select.where = reduce(and_, conditions) + sql_select.where = reduce(and_, conditions) # type: ignore + + # config sql with ? as param style + Flavor.set(Flavor(paramstyle="qmark")) sql, args = tuple(sql_select) result_set = self.client.select(sql, args) @@ -251,7 +252,7 @@ class DBAccountsRepository(AccountsRepositoryInterface, DBRepositoryInterface): return And((a, b)) if len(conditions) > 0: - sql_select.where = reduce(and_, conditions) + sql_select.where = reduce(and_, conditions) # type: ignore sql, args = tuple(sql_select) result_set = self.client.select(sql, args) diff --git a/tikka/adapters/repository/indexers.py b/tikka/adapters/repository/indexers.py index c09b403d1574d397e7ea42ee44bd7c8e23affb3e..b3148edfa7a1f085ca76f5548c037356cc511fdd 100644 --- a/tikka/adapters/repository/indexers.py +++ b/tikka/adapters/repository/indexers.py @@ -23,8 +23,6 @@ from tikka.interfaces.adapters.repository.indexers import IndexersRepositoryInte TABLE_NAME = "indexers" -# config sql with ? as param style -Flavor.set(Flavor(paramstyle="qmark")) # create sql table wrapper sql_indexers_table = Table(TABLE_NAME) @@ -74,6 +72,9 @@ class DBIndexersRepository(IndexersRepositoryInterface, DBRepositoryInterface): # create select query wrapper without order by sql_select = sql_indexers_table.select(offset=offset, limit=limit) + # config sql with ? as param style + Flavor.set(Flavor(paramstyle="qmark")) + sql, args = tuple(sql_select) result_set = self.client.select(sql, args) list_ = [] diff --git a/uv.lock b/uv.lock index 56de429dbe1c03dd003b17e84599e0fa1d27af6b..b502bf32399ee7ddbffcc03cd99295f488412f9d 100644 --- a/uv.lock +++ b/uv.lock @@ -1837,7 +1837,7 @@ wheels = [ [[package]] name = "tikka" -version = "0.14.1" +version = "0.14.2" source = { editable = "." } dependencies = [ { name = "dateutils" },