Skip to content

Commit 3341eb1

Browse files
committed
adds tests for icon
1 parent 6338615 commit 3341eb1

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

services/catalog/tests/unit/with_dbs/test_api_rpc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from models_library.services_types import ServiceKey, ServiceVersion
1717
from models_library.users import UserID
1818
from pydantic import ValidationError
19-
from pytest_simcore.helpers.faker_factories import random_user
19+
from pytest_simcore.helpers.faker_factories import random_icon_url, random_user
2020
from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict
2121
from pytest_simcore.helpers.postgres_tools import insert_and_get_row_lifespan
2222
from pytest_simcore.helpers.typing_env import EnvVarsDict
@@ -134,6 +134,7 @@ async def test_rpc_catalog_client(
134134
product_name: ProductName,
135135
user_id: UserID,
136136
app: FastAPI,
137+
faker: Faker,
137138
):
138139
assert app
139140

@@ -178,6 +179,7 @@ async def test_rpc_catalog_client(
178179
update={
179180
"name": "foo",
180181
"description": "bar",
182+
"icon": random_icon_url(faker),
181183
"version_display": "this is a nice version",
182184
"description_ui": True, # owner activates wiki view
183185
}, # type: ignore
@@ -189,6 +191,7 @@ async def test_rpc_catalog_client(
189191
assert updated.description == "bar"
190192
assert updated.description_ui
191193
assert updated.version_display == "this is a nice version"
194+
assert updated.icon is not None
192195
assert not updated.classifiers
193196

194197
got = await get_service(

services/web/server/tests/unit/with_dbs/01/test_catalog_handlers__services.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import pytest
99
from aiohttp import web
1010
from aiohttp.test_utils import TestClient
11+
from faker import Faker
1112
from models_library.api_schemas_catalog.services import ServiceGetV2
1213
from models_library.api_schemas_webserver.catalog import (
1314
CatalogServiceGet,
@@ -22,6 +23,7 @@
2223
from pydantic import NonNegativeInt, TypeAdapter
2324
from pytest_mock import MockerFixture
2425
from pytest_simcore.helpers.assert_checks import assert_status
26+
from pytest_simcore.helpers.faker_factories import random_icon_url
2527
from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict
2628
from pytest_simcore.helpers.typing_env import EnvVarsDict
2729
from pytest_simcore.helpers.webserver_login import UserInfoDict
@@ -162,6 +164,7 @@ async def test_get_and_patch_service(
162164
client: TestClient,
163165
logged_user: UserInfoDict,
164166
mocked_rpc_catalog_service_api: dict[str, MagicMock],
167+
faker: Faker,
165168
):
166169
assert client.app
167170
assert client.app.router
@@ -190,8 +193,8 @@ async def test_get_and_patch_service(
190193
# PATCH
191194
update = CatalogServiceUpdate(
192195
name="foo",
193-
thumbnail=None,
194196
description="bar",
197+
icon=random_icon_url(faker),
195198
classifiers=None,
196199
versionDisplay="Some nice name",
197200
descriptionUi=True,
@@ -209,6 +212,7 @@ async def test_get_and_patch_service(
209212
assert model.key == service_key
210213
assert model.version == service_version
211214
assert model.name == update.name
215+
assert model.icon == update.icon
212216
assert model.description == update.description
213217
assert model.description_ui == update.description_ui
214218
assert model.version_display == update.version_display

0 commit comments

Comments
 (0)