Skip to content

Commit 28c86ff

Browse files
open api specs
1 parent 9b24815 commit 28c86ff

File tree

3 files changed

+43
-14
lines changed

3 files changed

+43
-14
lines changed

packages/models-library/src/models_library/license_goods.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
from enum import auto
33
from typing import TypeAlias
44

5-
from pydantic import BaseModel, ConfigDict, Field, PositiveInt
5+
from pydantic import BaseModel, ConfigDict, Field
66

77
from .products import ProductName
88
from .resource_tracker import PricingPlanId
99
from .utils.enums import StrAutoEnum
1010

11-
LicenseGoodID: TypeAlias = PositiveInt
11+
LicenseGoodID: TypeAlias = str
1212

1313

1414
class LicenseResourceType(StrAutoEnum):

services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2969,10 +2969,8 @@ paths:
29692969
in: path
29702970
required: true
29712971
schema:
2972-
type: integer
2973-
exclusiveMinimum: true
2972+
type: string
29742973
title: License Good Id
2975-
minimum: 0
29762974
responses:
29772975
'200':
29782976
description: Successful Response
@@ -2996,10 +2994,8 @@ paths:
29962994
in: path
29972995
required: true
29982996
schema:
2999-
type: integer
3000-
exclusiveMinimum: true
2997+
type: string
30012998
title: License Good Id
3002-
minimum: 0
30032999
requestBody:
30043000
required: true
30053001
content:
@@ -4544,7 +4540,7 @@ paths:
45444540
'403':
45454541
description: ProjectInvalidRightsError
45464542
'404':
4547-
description: UserDefaultWalletNotFoundError, ProjectNotFoundError
4543+
description: ProjectNotFoundError, UserDefaultWalletNotFoundError
45484544
'409':
45494545
description: ProjectTooManyProjectOpenedError
45504546
'422':
@@ -10010,10 +10006,8 @@ components:
1001010006
LicenseGoodGet:
1001110007
properties:
1001210008
licenseGoodId:
10013-
type: integer
10014-
exclusiveMinimum: true
10009+
type: string
1001510010
title: Licensegoodid
10016-
minimum: 0
1001710011
name:
1001810012
type: string
1001910013
title: Name

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

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,55 @@
1717
from models_library.rest_ordering import OrderBy
1818
from pytest_simcore.helpers.webserver_login import UserInfoDict
1919
from servicelib.aiohttp import status
20+
from simcore_postgres_database.models.resource_tracker_pricing_plans import (
21+
resource_tracker_pricing_plans,
22+
)
23+
from simcore_postgres_database.utils_repos import transaction_context
2024
from simcore_service_webserver.db.models import UserRole
25+
from simcore_service_webserver.db.plugin import get_asyncpg_engine
2126
from simcore_service_webserver.licenses import _license_goods_db
2227
from simcore_service_webserver.licenses.errors import LicenseGoodNotFoundError
2328
from simcore_service_webserver.projects.models import ProjectDict
2429

2530

31+
@pytest.fixture
32+
async def pricing_plan_id(
33+
client: TestClient,
34+
osparc_product_name: str,
35+
) -> AsyncIterator[int]:
36+
assert client.app
37+
38+
async with transaction_context(get_asyncpg_engine(client.app)) as conn:
39+
result = await conn.execute(
40+
resource_tracker_pricing_plans.insert()
41+
.values(
42+
product_name=osparc_product_name,
43+
display_name="ISolve Thermal",
44+
description="",
45+
classification="TIER",
46+
is_active=True,
47+
pricing_plan_key="isolve-thermal",
48+
)
49+
.returning(resource_tracker_pricing_plans.c.pricing_plan_id)
50+
)
51+
row = result.first()
52+
53+
assert row
54+
55+
yield int(row[0])
56+
57+
async with transaction_context(get_asyncpg_engine(client.app)) as conn:
58+
result = await conn.execute(resource_tracker_pricing_plans.delete())
59+
60+
2661
@pytest.mark.parametrize("user_role,expected", [(UserRole.USER, status.HTTP_200_OK)])
2762
async def test_license_goods_db_crud(
2863
client: TestClient,
2964
logged_user: UserInfoDict,
3065
user_project: ProjectDict,
3166
osparc_product_name: str,
3267
expected: HTTPStatus,
33-
workspaces_clean_db: AsyncIterator[None],
68+
pricing_plan_id: int,
3469
):
3570
assert client.app
3671

@@ -48,7 +83,7 @@ async def test_license_goods_db_crud(
4883
product_name=osparc_product_name,
4984
name="Model A",
5085
license_resource_type=LicenseResourceType.VIP_MODEL,
51-
pricing_plan_id=1,
86+
pricing_plan_id=pricing_plan_id,
5287
)
5388
_license_good_id = license_good_db.license_good_id
5489

0 commit comments

Comments
 (0)