Skip to content

Commit 1a2d1ca

Browse files
fix tests
1 parent 9c6e441 commit 1a2d1ca

5 files changed

+67
-21
lines changed

services/resource-usage-tracker/tests/unit/with_dbs/test_api_resource_tracker_pricing_plans.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from simcore_postgres_database.models.resource_tracker_pricing_units import (
2828
resource_tracker_pricing_units,
2929
)
30+
from simcore_postgres_database.models.services import services_meta_data
3031
from starlette import status
3132
from yarl import URL
3233

@@ -184,6 +185,15 @@ def resource_tracker_pricing_tables_db(postgres_db: sa.engine.Engine) -> Iterato
184185
modified=datetime.now(tz=timezone.utc),
185186
)
186187
)
188+
189+
con.execute(
190+
services_meta_data.insert().values(
191+
key=_SERVICE_KEY,
192+
version=_SERVICE_VERSION,
193+
name="name",
194+
description="description",
195+
)
196+
)
187197
con.execute(
188198
resource_tracker_pricing_plan_to_service.insert().values(
189199
pricing_plan_id=_PRICING_PLAN_ID,
@@ -192,6 +202,15 @@ def resource_tracker_pricing_tables_db(postgres_db: sa.engine.Engine) -> Iterato
192202
service_default_plan=True,
193203
)
194204
)
205+
206+
con.execute(
207+
services_meta_data.insert().values(
208+
key=_SERVICE_KEY_2,
209+
version=_SERVICE_VERSION_2,
210+
name="name",
211+
description="description",
212+
)
213+
)
195214
con.execute(
196215
resource_tracker_pricing_plan_to_service.insert().values(
197216
pricing_plan_id=_PRICING_PLAN_ID_2,

services/resource-usage-tracker/tests/unit/with_dbs/test_api_resource_tracker_pricing_plans_rpc.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ async def test_rpc_pricing_plans_workflow(
6868
result = await pricing_plans.create_pricing_plan(
6969
rpc_client,
7070
data=PricingPlanCreate(
71-
product_name="s4l",
71+
product_name="osparc",
7272
display_name=_display_name,
7373
description=faker.sentence(),
7474
classification=PricingPlanClassification.TIER,
@@ -84,7 +84,7 @@ async def test_rpc_pricing_plans_workflow(
8484
_update_description = "description name updated"
8585
result = await pricing_plans.update_pricing_plan(
8686
rpc_client,
87-
product_name="s4l",
87+
product_name="osparc",
8888
data=PricingPlanUpdate(
8989
pricing_plan_id=_pricing_plan_id,
9090
display_name=_update_display_name,
@@ -99,7 +99,7 @@ async def test_rpc_pricing_plans_workflow(
9999

100100
result = await pricing_plans.get_pricing_plan(
101101
rpc_client,
102-
product_name="s4l",
102+
product_name="osparc",
103103
pricing_plan_id=_pricing_plan_id,
104104
)
105105
assert isinstance(result, PricingPlanGet)
@@ -110,7 +110,7 @@ async def test_rpc_pricing_plans_workflow(
110110

111111
result = await pricing_plans.list_pricing_plans(
112112
rpc_client,
113-
product_name="s4l",
113+
product_name="osparc",
114114
)
115115
assert isinstance(result, list)
116116
assert len(result) == 1
@@ -120,7 +120,7 @@ async def test_rpc_pricing_plans_workflow(
120120
# Now I will deactivate the pricing plan
121121
result = await pricing_plans.update_pricing_plan(
122122
rpc_client,
123-
product_name="s4l",
123+
product_name="osparc",
124124
data=PricingPlanUpdate(
125125
pricing_plan_id=_pricing_plan_id,
126126
display_name=faker.word(),
@@ -142,7 +142,7 @@ async def test_rpc_pricing_plans_with_units_workflow(
142142
result = await pricing_plans.create_pricing_plan(
143143
rpc_client,
144144
data=PricingPlanCreate(
145-
product_name="s4l",
145+
product_name="osparc",
146146
display_name=_display_name,
147147
description=faker.sentence(),
148148
classification=PricingPlanClassification.TIER,
@@ -156,7 +156,7 @@ async def test_rpc_pricing_plans_with_units_workflow(
156156

157157
result = await pricing_units.create_pricing_unit(
158158
rpc_client,
159-
product_name="s4l",
159+
product_name="osparc",
160160
data=PricingUnitWithCostCreate(
161161
pricing_plan_id=_pricing_plan_id,
162162
unit_name="SMALL",
@@ -175,7 +175,7 @@ async def test_rpc_pricing_plans_with_units_workflow(
175175
# Get pricing plan
176176
result = await pricing_plans.get_pricing_plan(
177177
rpc_client,
178-
product_name="s4l",
178+
product_name="osparc",
179179
pricing_plan_id=_pricing_plan_id,
180180
)
181181
assert isinstance(result, PricingPlanGet)
@@ -187,7 +187,7 @@ async def test_rpc_pricing_plans_with_units_workflow(
187187
_unit_name = "VERY SMALL"
188188
result = await pricing_units.update_pricing_unit(
189189
rpc_client,
190-
product_name="s4l",
190+
product_name="osparc",
191191
data=PricingUnitWithCostUpdate(
192192
pricing_plan_id=_pricing_plan_id,
193193
pricing_unit_id=_first_pricing_unit_id,
@@ -206,7 +206,7 @@ async def test_rpc_pricing_plans_with_units_workflow(
206206
# Update pricing unit with COST update!
207207
result = await pricing_units.update_pricing_unit(
208208
rpc_client,
209-
product_name="s4l",
209+
product_name="osparc",
210210
data=PricingUnitWithCostUpdate(
211211
pricing_plan_id=_pricing_plan_id,
212212
pricing_unit_id=_first_pricing_unit_id,
@@ -228,7 +228,7 @@ async def test_rpc_pricing_plans_with_units_workflow(
228228
# Test get pricing unit
229229
result = await pricing_units.get_pricing_unit(
230230
rpc_client,
231-
product_name="s4l",
231+
product_name="osparc",
232232
pricing_plan_id=_pricing_plan_id,
233233
pricing_unit_id=_first_pricing_unit_id,
234234
)
@@ -238,7 +238,7 @@ async def test_rpc_pricing_plans_with_units_workflow(
238238
# Create one more unit
239239
result = await pricing_units.create_pricing_unit(
240240
rpc_client,
241-
product_name="s4l",
241+
product_name="osparc",
242242
data=PricingUnitWithCostCreate(
243243
pricing_plan_id=_pricing_plan_id,
244244
unit_name="LARGE",
@@ -256,7 +256,7 @@ async def test_rpc_pricing_plans_with_units_workflow(
256256
# Get pricing plan with units
257257
result = await pricing_plans.get_pricing_plan(
258258
rpc_client,
259-
product_name="s4l",
259+
product_name="osparc",
260260
pricing_plan_id=_pricing_plan_id,
261261
)
262262
assert isinstance(result, PricingPlanGet)
@@ -275,7 +275,7 @@ async def test_rpc_pricing_plans_to_service_workflow(
275275
result = await pricing_plans.create_pricing_plan(
276276
rpc_client,
277277
data=PricingPlanCreate(
278-
product_name="s4l",
278+
product_name="osparc",
279279
display_name=faker.word(),
280280
description=faker.sentence(),
281281
classification=PricingPlanClassification.TIER,
@@ -288,7 +288,7 @@ async def test_rpc_pricing_plans_to_service_workflow(
288288
result = (
289289
await pricing_plans.list_connected_services_to_pricing_plan_by_pricing_plan(
290290
rpc_client,
291-
product_name="s4l",
291+
product_name="osparc",
292292
pricing_plan_id=_pricing_plan_id,
293293
)
294294
)
@@ -298,7 +298,7 @@ async def test_rpc_pricing_plans_to_service_workflow(
298298
_first_service_version = ServiceVersion("2.0.2")
299299
result = await pricing_plans.connect_service_to_pricing_plan(
300300
rpc_client,
301-
product_name="s4l",
301+
product_name="osparc",
302302
pricing_plan_id=_pricing_plan_id,
303303
service_key=ServiceKey("simcore/services/comp/itis/sleeper"),
304304
service_version=_first_service_version,
@@ -310,7 +310,7 @@ async def test_rpc_pricing_plans_to_service_workflow(
310310
result = (
311311
await pricing_plans.list_connected_services_to_pricing_plan_by_pricing_plan(
312312
rpc_client,
313-
product_name="s4l",
313+
product_name="osparc",
314314
pricing_plan_id=_pricing_plan_id,
315315
)
316316
)
@@ -321,7 +321,7 @@ async def test_rpc_pricing_plans_to_service_workflow(
321321
_second_service_version = ServiceVersion("3.0.0")
322322
result = await pricing_plans.connect_service_to_pricing_plan(
323323
rpc_client,
324-
product_name="s4l",
324+
product_name="osparc",
325325
pricing_plan_id=_pricing_plan_id,
326326
service_key=ServiceKey("simcore/services/comp/itis/sleeper"),
327327
service_version=_second_service_version,
@@ -333,7 +333,7 @@ async def test_rpc_pricing_plans_to_service_workflow(
333333
result = (
334334
await pricing_plans.list_connected_services_to_pricing_plan_by_pricing_plan(
335335
rpc_client,
336-
product_name="s4l",
336+
product_name="osparc",
337337
pricing_plan_id=_pricing_plan_id,
338338
)
339339
)
@@ -344,7 +344,7 @@ async def test_rpc_pricing_plans_to_service_workflow(
344344
_different_service_key = ServiceKey("simcore/services/comp/itis/different-service")
345345
result = await pricing_plans.connect_service_to_pricing_plan(
346346
rpc_client,
347-
product_name="s4l",
347+
product_name="osparc",
348348
pricing_plan_id=_pricing_plan_id,
349349
service_key=_different_service_key,
350350
service_version=ServiceVersion("1.0.0"),
@@ -356,7 +356,7 @@ async def test_rpc_pricing_plans_to_service_workflow(
356356
result = (
357357
await pricing_plans.list_connected_services_to_pricing_plan_by_pricing_plan(
358358
rpc_client,
359-
product_name="s4l",
359+
product_name="osparc",
360360
pricing_plan_id=_pricing_plan_id,
361361
)
362362
)

services/resource-usage-tracker/tests/unit/with_dbs/test_process_rabbitmq_message_triggered_by_listening_with_billing.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from simcore_postgres_database.models.resource_tracker_pricing_units import (
2929
resource_tracker_pricing_units,
3030
)
31+
from simcore_postgres_database.models.services import services_meta_data
3132

3233
from .conftest import assert_service_runs_db_row
3334

@@ -128,6 +129,14 @@ def resource_tracker_pricing_tables_db(postgres_db: sa.engine.Engine) -> Iterato
128129
modified=datetime.now(tz=timezone.utc),
129130
)
130131
)
132+
con.execute(
133+
services_meta_data.insert().values(
134+
key="simcore/services/comp/itis/sleeper",
135+
version="1.0.16",
136+
name="name",
137+
description="description",
138+
)
139+
)
131140
con.execute(
132141
resource_tracker_pricing_plan_to_service.insert().values(
133142
pricing_plan_id=1,

services/resource-usage-tracker/tests/unit/with_dbs/test_process_rabbitmq_message_with_billing.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from simcore_postgres_database.models.resource_tracker_pricing_units import (
3131
resource_tracker_pricing_units,
3232
)
33+
from simcore_postgres_database.models.services import services_meta_data
3334
from simcore_service_resource_usage_tracker.modules.db.repositories.resource_tracker import (
3435
ResourceTrackerRepository,
3536
)
@@ -142,6 +143,14 @@ def resource_tracker_pricing_tables_db(postgres_db: sa.engine.Engine) -> Iterato
142143
modified=datetime.now(tz=timezone.utc),
143144
)
144145
)
146+
con.execute(
147+
services_meta_data.insert().values(
148+
key="simcore/services/comp/itis/sleeper",
149+
version="1.0.16",
150+
name="name",
151+
description="description",
152+
)
153+
)
145154
con.execute(
146155
resource_tracker_pricing_plan_to_service.insert().values(
147156
pricing_plan_id=1,

services/resource-usage-tracker/tests/unit/with_dbs/test_process_rabbitmq_message_with_billing_cost_0.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from simcore_postgres_database.models.resource_tracker_pricing_units import (
3131
resource_tracker_pricing_units,
3232
)
33+
from simcore_postgres_database.models.services import services_meta_data
3334
from simcore_service_resource_usage_tracker.modules.db.repositories.resource_tracker import (
3435
ResourceTrackerRepository,
3536
)
@@ -88,6 +89,14 @@ def resource_tracker_pricing_tables_db(postgres_db: sa.engine.Engine) -> Iterato
8889
modified=datetime.now(tz=timezone.utc),
8990
)
9091
)
92+
con.execute(
93+
services_meta_data.insert().values(
94+
key="simcore/services/comp/itis/sleeper",
95+
version="1.0.16",
96+
name="name",
97+
description="description",
98+
)
99+
)
91100
con.execute(
92101
resource_tracker_pricing_plan_to_service.insert().values(
93102
pricing_plan_id=1,

0 commit comments

Comments
 (0)