|
4 | 4 |
|
5 | 5 | from collections.abc import Callable |
6 | 6 |
|
| 7 | +import simcore_service_catalog.service.access_rights |
7 | 8 | from fastapi import FastAPI |
8 | 9 | from models_library.groups import GroupAtDB |
9 | 10 | from models_library.products import ProductName |
@@ -93,28 +94,29 @@ async def test_auto_upgrade_policy( |
93 | 94 | everyone_gid, user_gid, team_gid = user_groups_ids |
94 | 95 |
|
95 | 96 | # Avoids calls to director API |
96 | | - mocker.patch( |
97 | | - "simcore_service_catalog.services.access_rights._is_old_service", |
| 97 | + mocker.patch.object( |
| 98 | + simcore_service_catalog.service.access_rights, |
| 99 | + "_is_old_service", |
98 | 100 | return_value=False, |
99 | 101 | ) |
100 | 102 | # Avoids creating a users + user_to_group table |
101 | | - data = GroupAtDB.model_config["json_schema_extra"]["example"] |
| 103 | + data = GroupAtDB.model_json_schema()["example"] |
102 | 104 | data["gid"] = everyone_gid |
103 | | - mocker.patch( |
104 | | - "simcore_service_catalog.services.access_rights.GroupsRepository.get_everyone_group", |
| 105 | + mocker.patch.object( |
| 106 | + simcore_service_catalog.service.access_rights.GroupsRepository, |
| 107 | + "get_everyone_group", |
105 | 108 | return_value=GroupAtDB.model_validate(data), |
106 | 109 | ) |
107 | | - mocker.patch( |
108 | | - "simcore_service_catalog.services.access_rights.GroupsRepository.get_user_gid_from_email", |
| 110 | + mocker.patch.object( |
| 111 | + simcore_service_catalog.service.access_rights.GroupsRepository, |
| 112 | + "get_user_gid_from_email", |
109 | 113 | return_value=user_gid, |
110 | 114 | ) |
111 | 115 |
|
112 | 116 | # SETUP --- |
113 | 117 | MOST_UPDATED_EXAMPLE = -1 |
114 | 118 | new_service_metadata = ServiceMetaDataPublished.model_validate( |
115 | | - ServiceMetaDataPublished.model_config["json_schema_extra"]["examples"][ |
116 | | - MOST_UPDATED_EXAMPLE |
117 | | - ] |
| 119 | + ServiceMetaDataPublished.model_json_schema()["examples"][MOST_UPDATED_EXAMPLE] |
118 | 120 | ) |
119 | 121 | new_service_metadata.version = TypeAdapter(ServiceVersion).validate_python("1.0.11") |
120 | 122 |
|
|
0 commit comments