Skip to content

Commit c6ae907

Browse files
committed
remove usage of deleted code
1 parent 4329439 commit c6ae907

File tree

2 files changed

+10
-47
lines changed

2 files changed

+10
-47
lines changed

services/director-v2/tests/unit/test_models_clusters.py

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,16 @@
1-
from pprint import pformat
2-
from typing import Any
3-
4-
import pytest
51
from faker import Faker
62
from models_library.api_schemas_directorv2.clusters import (
73
AvailableResources,
8-
ClusterCreate,
9-
ClusterPatch,
104
Scheduler,
115
UsedResources,
126
Worker,
137
WorkerMetrics,
148
)
159
from models_library.clusters import ClusterTypeInModel
16-
from pydantic import BaseModel, ByteSize, TypeAdapter
10+
from pydantic import ByteSize, TypeAdapter
1711
from simcore_postgres_database.models.clusters import ClusterType
1812

1913

20-
@pytest.mark.parametrize(
21-
"model_cls",
22-
[ClusterCreate, ClusterPatch],
23-
)
24-
def test_clusters_model_examples(
25-
model_cls: type[BaseModel], model_cls_examples: dict[str, dict[str, Any]]
26-
):
27-
for name, example in model_cls_examples.items():
28-
print(name, ":", pformat(example))
29-
model_instance = model_cls(**example)
30-
assert model_instance, f"Failed with {name}"
31-
32-
33-
@pytest.mark.parametrize(
34-
"model_cls",
35-
[
36-
ClusterCreate,
37-
],
38-
)
39-
def test_cluster_creation_brings_default_thumbail(
40-
model_cls: type[BaseModel], model_cls_examples: dict[str, dict[str, Any]]
41-
):
42-
for example in model_cls_examples.values():
43-
if "thumbnail" in example:
44-
example.pop("thumbnail")
45-
instance = model_cls(**example)
46-
assert instance
47-
assert instance.thumbnail
48-
49-
5014
def test_scheduler_constructor_with_default_has_correct_dict(faker: Faker):
5115
scheduler = Scheduler(status=faker.text())
5216
assert scheduler.workers is not None

services/director-v2/tests/unit/test_modules_dask_clients_pool.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
# pylint:disable=redefined-outer-name
44

55

6+
from collections.abc import AsyncIterator, Callable
67
from random import choice
7-
from typing import Any, AsyncIterator, Callable, get_args
8+
from typing import Any, get_args
89
from unittest import mock
910

1011
import pytest
@@ -15,10 +16,8 @@
1516
Cluster,
1617
ClusterAuthentication,
1718
ClusterTypeInModel,
18-
JupyterHubTokenAuthentication,
19-
KerberosAuthentication,
2019
NoAuthentication,
21-
SimpleAuthentication,
20+
TLSAuthentication,
2221
)
2322
from pytest_mock.plugin import MockerFixture
2423
from pytest_simcore.helpers.typing_env import EnvVarsDict
@@ -82,7 +81,7 @@ def test_dask_clients_pool_properly_setup_and_deleted(
8281
def fake_clusters(faker: Faker) -> Callable[[int], list[Cluster]]:
8382
def creator(num_clusters: int) -> list[Cluster]:
8483
fake_clusters = []
85-
for n in range(num_clusters):
84+
for _n in range(num_clusters):
8685
fake_clusters.append(
8786
Cluster.model_validate(
8887
{
@@ -94,12 +93,11 @@ def creator(num_clusters: int) -> list[Cluster]:
9493
"authentication": choice(
9594
[
9695
NoAuthentication(),
97-
SimpleAuthentication(
98-
username=faker.user_name(),
99-
password=faker.password(),
96+
TLSAuthentication(
97+
client_cert=faker.pystr(),
98+
client_key=faker.pystr(),
99+
ca_cert=faker.pystr(),
100100
),
101-
KerberosAuthentication(),
102-
JupyterHubTokenAuthentication(api_token=faker.uuid4()),
103101
]
104102
),
105103
}
@@ -155,6 +153,7 @@ async def test_dask_clients_pool_acquisition_creates_client_on_demand(
155153

156154
clusters = fake_clusters(30)
157155
mocked_creation_calls = []
156+
assert client.app
158157
for cluster in clusters:
159158
mocked_creation_calls.append(
160159
mock.call(

0 commit comments

Comments
 (0)