File tree 2 files changed +18
-2
lines changed
src/simcore_service_webserver/licenses
tests/unit/with_dbs/04/licenses
2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -313,11 +313,11 @@ async def list_licensed_items(
313
313
)
314
314
315
315
if filter_by_licensed_resource_type :
316
- base_query .where (
316
+ base_query = base_query .where (
317
317
licensed_items .c .licensed_resource_type == filter_by_licensed_resource_type
318
318
)
319
319
if not include_hidden_items_on_market :
320
- base_query .where (licensed_items .c .is_hidden_on_market .is_ (False ))
320
+ base_query = base_query .where (licensed_items .c .is_hidden_on_market .is_ (False ))
321
321
322
322
# Select total count from base_query
323
323
subquery = base_query .subquery ()
Original file line number Diff line number Diff line change 27
27
from simcore_postgres_database .models .licensed_item_to_resource import (
28
28
licensed_item_to_resource ,
29
29
)
30
+ from simcore_postgres_database .models .licensed_items import licensed_items
30
31
from simcore_postgres_database .utils_repos import transaction_context
31
32
from simcore_service_webserver .db .models import UserRole
32
33
from simcore_service_webserver .db .plugin import get_asyncpg_engine
@@ -103,6 +104,21 @@ async def test_licensed_items_listing(
103
104
assert "additionalField" not in source
104
105
assert "additional_field" not in source
105
106
107
+ # Testing hidden flag
108
+ async with transaction_context (get_asyncpg_engine (client .app )) as conn :
109
+ await conn .execute (
110
+ licensed_items .update ()
111
+ .values (
112
+ is_hidden_on_market = True ,
113
+ )
114
+ .where (licensed_items .c .licensed_item_id == _licensed_item_id )
115
+ )
116
+
117
+ url = client .app .router ["list_licensed_items" ].url_for ()
118
+ resp = await client .get (f"{ url } " )
119
+ data , _ = await assert_status (resp , status .HTTP_200_OK )
120
+ assert data == []
121
+
106
122
107
123
_LICENSED_ITEM_PURCHASE_GET = (
108
124
rut_licensed_items_purchases .LicensedItemPurchaseGet .model_validate (
You can’t perform that action at this time.
0 commit comments