Skip to content

Commit 8a0c0a1

Browse files
committed
fixes tests
1 parent 775f361 commit 8a0c0a1

File tree

5 files changed

+21
-12
lines changed

5 files changed

+21
-12
lines changed

packages/models-library/src/models_library/api_schemas_webserver/licensed_items.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,16 @@ class LicensedItemGet(OutputSchema):
4141
def from_domain_model(cls, licensed_item_db: LicensedItemDB) -> Self:
4242
return cls.model_validate(
4343
remap_keys(
44-
licensed_item_db.model_dump(),
44+
licensed_item_db.model_dump(
45+
include={
46+
"licensed_item_id",
47+
"licensed_resource_name",
48+
"license_key",
49+
"pricing_plan_id",
50+
"created",
51+
"modified",
52+
}
53+
),
4554
{
4655
"licensed_resource_name": "name",
4756
"created": "created_at",

services/web/server/src/simcore_service_webserver/licenses/_licensed_items_repository.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ async def create(
4141
app: web.Application,
4242
connection: AsyncConnection | None = None,
4343
*,
44-
product_name: ProductName,
45-
name: str,
44+
licensed_resource_name: str,
4645
licensed_resource_type: LicensedResourceType,
47-
pricing_plan_id: PricingPlanId,
46+
product_name: ProductName | None,
47+
pricing_plan_id: PricingPlanId | None,
4848
) -> LicensedItemDB:
4949
async with transaction_context(get_asyncpg_engine(app), connection) as conn:
5050
result = await conn.execute(
5151
licensed_items.insert()
5252
.values(
53-
name=name,
53+
licensed_resource_name=licensed_resource_name,
5454
licensed_resource_type=licensed_resource_type,
5555
pricing_plan_id=pricing_plan_id,
5656
product_name=product_name,
@@ -90,12 +90,12 @@ async def list_(
9090
if inactive == "exclude":
9191
base_query = base_query.where(
9292
licensed_items.c.product_name.is_(None)
93-
or licensed_items.c.licensed_item_id.is_(None)
93+
| licensed_items.c.licensed_item_id.is_(None)
9494
)
9595
elif inactive == "only":
9696
base_query = base_query.where(
9797
licensed_items.c.product_name.is_not(None)
98-
and licensed_items.c.licensed_item_id.is_not(None)
98+
& licensed_items.c.licensed_item_id.is_not(None)
9999
)
100100

101101
# Select total count from base_query

services/web/server/tests/unit/with_dbs/04/licenses/test_licensed_items_repository.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async def test_licensed_items_db_crud(
4646
licensed_item_db = await _licensed_items_repository.create(
4747
client.app,
4848
product_name=osparc_product_name,
49-
name="Model A",
49+
licensed_resource_name="Model A",
5050
licensed_resource_type=LicensedResourceType.VIP_MODEL,
5151
pricing_plan_id=pricing_plan_id,
5252
)
@@ -111,7 +111,7 @@ async def test_licensed_items_db_trash(
111111
licensed_item_db = await _licensed_items_repository.create(
112112
client.app,
113113
product_name=osparc_product_name,
114-
name=name,
114+
licensed_resource_name=name,
115115
licensed_resource_type=LicensedResourceType.VIP_MODEL,
116116
pricing_plan_id=pricing_plan_id,
117117
)

services/web/server/tests/unit/with_dbs/04/licenses/test_licensed_items_rest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async def test_licensed_items_listing(
4242
licensed_item_db = await _licensed_items_repository.create(
4343
client.app,
4444
product_name=osparc_product_name,
45-
name="Model A",
45+
licensed_resource_name="Model A",
4646
licensed_resource_type=LicensedResourceType.VIP_MODEL,
4747
pricing_plan_id=pricing_plan_id,
4848
)
@@ -109,7 +109,7 @@ async def test_licensed_items_purchase(
109109
licensed_item_db = await _licensed_items_repository.create(
110110
client.app,
111111
product_name=osparc_product_name,
112-
name="Model A",
112+
licensed_resource_name="Model A",
113113
licensed_resource_type=LicensedResourceType.VIP_MODEL,
114114
pricing_plan_id=pricing_plan_id,
115115
)

services/web/server/tests/unit/with_dbs/04/licenses/test_licenses_rpc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ async def test_license_checkout_workflow(
135135
license_item_db = await _licensed_items_repository.create(
136136
client.app,
137137
product_name=osparc_product_name,
138-
name="Model A",
138+
licensed_resource_name="Model A",
139139
licensed_resource_type=LicensedResourceType.VIP_MODEL,
140140
pricing_plan_id=pricing_plan_id,
141141
)

0 commit comments

Comments
 (0)