Skip to content

Commit 9bf1ead

Browse files
committed
droping old dependencies
1 parent c72f30d commit 9bf1ead

File tree

3 files changed

+21
-30
lines changed

3 files changed

+21
-30
lines changed

services/web/server/tests/unit/with_dbs/03/invitations/test_login_handlers_registration_invitations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def _extract_invitation_code_from_url(invitation_url: HttpUrl) -> str:
113113
@pytest.mark.acceptance_test()
114114
async def test_registration_to_different_product(
115115
mocker: MockerFixture,
116-
all_products_names: list[ProductName],
116+
app_products_names: list[ProductName],
117117
client: TestClient,
118118
guest_email: str,
119119
guest_password: str,
@@ -146,8 +146,8 @@ async def _register_account(invitation_url: HttpUrl, product_deployed: ProductNa
146146
headers={X_PRODUCT_NAME_HEADER: product_deployed},
147147
)
148148

149-
product_a = all_products_names[0]
150-
product_b = all_products_names[1]
149+
product_a = app_products_names[0]
150+
product_b = app_products_names[1]
151151

152152
# PO creates an two invitations for guest in product A and product B
153153
invitation_product_a = await generate_invitation(

services/web/server/tests/unit/with_dbs/04/products/test_products_rest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,15 @@ async def test_get_product(
128128
],
129129
)
130130
async def test_get_current_product_ui(
131-
all_products_names: list[ProductName],
131+
app_products_names: list[ProductName],
132132
product_name: ProductName,
133133
logged_user: UserInfoDict,
134134
client: TestClient,
135135
user_role: UserRole,
136136
expected_status_code: int,
137137
):
138138
assert logged_user["role"] == user_role.value
139-
assert product_name in all_products_names
139+
assert product_name in app_products_names
140140

141141
# give access to user to this product
142142
assert client.app

services/web/server/tests/unit/with_dbs/conftest.py

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
"""Configuration for unit testing with a postgress fixture
2-
3-
- Unit testing of webserver app with a postgress service as fixture
4-
- Starts test session by running a postgres container as a fixture (see postgress_service)
5-
6-
IMPORTANT: remember that these are still unit-tests!
7-
"""
8-
9-
# nopycln: file
101
# pylint: disable=redefined-outer-name
112
# pylint: disable=unused-argument
123
# pylint: disable=unused-variable
4+
# pylint: disable=too-many-arguments
135

146
import asyncio
157
import random
@@ -36,7 +28,6 @@
3628
from aiohttp import web
3729
from aiohttp.test_utils import TestClient, TestServer
3830
from aiopg.sa import create_engine
39-
from aiopg.sa.connection import SAConnection
4031
from faker import Faker
4132
from models_library.api_schemas_directorv2.dynamic_services import DynamicServiceGet
4233
from models_library.products import ProductName
@@ -716,7 +707,7 @@ async def with_permitted_override_services_specifications(
716707

717708

718709
@pytest.fixture
719-
async def all_products_names(
710+
async def app_products_names(
720711
asyncpg_engine: AsyncEngine,
721712
) -> AsyncIterable[list[ProductName]]:
722713
async with asyncpg_engine.connect() as conn:
@@ -767,7 +758,7 @@ async def all_products_names(
767758
@pytest.fixture
768759
async def all_product_prices(
769760
asyncpg_engine: AsyncEngine,
770-
all_products_names: list[ProductName],
761+
app_products_names: list[ProductName],
771762
faker: Faker,
772763
) -> dict[ProductName, Decimal | None]:
773764
"""Initial list of prices for all products"""
@@ -783,7 +774,7 @@ async def all_product_prices(
783774
}
784775

785776
result = {}
786-
for product_name in all_products_names:
777+
for product_name in app_products_names:
787778
usd_or_none = product_price.get(product_name)
788779
if usd_or_none is not None:
789780
async with asyncpg_engine.begin() as conn:
@@ -806,23 +797,23 @@ async def all_product_prices(
806797
@pytest.fixture
807798
async def latest_osparc_price(
808799
all_product_prices: dict[ProductName, Decimal],
809-
_pre_connection: SAConnection,
800+
asyncpg_engine: AsyncEngine,
810801
) -> Decimal:
811802
"""This inserts a new price for osparc in the history
812803
(i.e. the old price of osparc is still in the database)
813804
"""
814-
815-
usd = await _pre_connection.scalar(
816-
products_prices.insert()
817-
.values(
818-
product_name="osparc",
819-
usd_per_credit=all_product_prices["osparc"] + 5,
820-
comment="New price for osparc",
821-
stripe_price_id="stripe-price-id",
822-
stripe_tax_rate_id="stripe-tax-rate-id",
805+
async with asyncpg_engine.begin() as conn:
806+
usd = await conn.scalar(
807+
products_prices.insert()
808+
.values(
809+
product_name="osparc",
810+
usd_per_credit=all_product_prices["osparc"] + 5,
811+
comment="New price for osparc",
812+
stripe_price_id="stripe-price-id",
813+
stripe_tax_rate_id="stripe-tax-rate-id",
814+
)
815+
.returning(products_prices.c.usd_per_credit)
823816
)
824-
.returning(products_prices.c.usd_per_credit)
825-
)
826817
assert usd is not None
827818
assert usd != all_product_prices["osparc"]
828819
return Decimal(usd)

0 commit comments

Comments
 (0)