|
6 | 6 |
|
7 | 7 | from data_rentgen.db.models import Dataset |
8 | 8 | from tests.fixtures.mocks import MockedUser |
| 9 | +from tests.test_server.utils.convert_to_json import dataset_to_json |
9 | 10 | from tests.test_server.utils.enrich import enrich_datasets |
10 | 11 |
|
11 | 12 | pytestmark = [pytest.mark.server, pytest.mark.asyncio] |
@@ -42,19 +43,7 @@ async def test_search_datasets_by_address_url( |
42 | 43 | }, |
43 | 44 | "items": [ |
44 | 45 | { |
45 | | - "data": { |
46 | | - "kind": "DATASET", |
47 | | - "id": dataset.id, |
48 | | - "format": dataset.format, |
49 | | - "name": dataset.name, |
50 | | - "location": { |
51 | | - "id": dataset.location.id, |
52 | | - "name": dataset.location.name, |
53 | | - "type": dataset.location.type, |
54 | | - "addresses": [{"url": address.url} for address in dataset.location.addresses], |
55 | | - "external_id": dataset.location.external_id, |
56 | | - }, |
57 | | - }, |
| 46 | + "data": dataset_to_json(dataset), |
58 | 47 | } |
59 | 48 | for dataset in datasets |
60 | 49 | ], |
@@ -102,19 +91,7 @@ async def test_search_datasets_by_location_name( |
102 | 91 | }, |
103 | 92 | "items": [ |
104 | 93 | { |
105 | | - "data": { |
106 | | - "kind": "DATASET", |
107 | | - "id": dataset.id, |
108 | | - "format": dataset.format, |
109 | | - "name": dataset.name, |
110 | | - "location": { |
111 | | - "id": dataset.location.id, |
112 | | - "name": dataset.location.name, |
113 | | - "type": dataset.location.type, |
114 | | - "addresses": [{"url": address.url} for address in dataset.location.addresses], |
115 | | - "external_id": dataset.location.external_id, |
116 | | - }, |
117 | | - }, |
| 94 | + "data": dataset_to_json(dataset), |
118 | 95 | } |
119 | 96 | for dataset in datasets |
120 | 97 | ], |
@@ -151,19 +128,7 @@ async def test_search_datasets_by_dataset_name( |
151 | 128 | }, |
152 | 129 | "items": [ |
153 | 130 | { |
154 | | - "data": { |
155 | | - "kind": "DATASET", |
156 | | - "id": dataset.id, |
157 | | - "format": dataset.format, |
158 | | - "name": dataset.name, |
159 | | - "location": { |
160 | | - "id": dataset.location.id, |
161 | | - "name": dataset.location.name, |
162 | | - "type": dataset.location.type, |
163 | | - "addresses": [{"url": address.url} for address in dataset.location.addresses], |
164 | | - "external_id": dataset.location.external_id, |
165 | | - }, |
166 | | - }, |
| 131 | + "data": dataset_to_json(dataset), |
167 | 132 | } |
168 | 133 | for dataset in datasets |
169 | 134 | ], |
@@ -207,19 +172,7 @@ async def test_search_datasets_by_location_name_and_address_url( |
207 | 172 | }, |
208 | 173 | "items": [ |
209 | 174 | { |
210 | | - "data": { |
211 | | - "kind": "DATASET", |
212 | | - "id": dataset.id, |
213 | | - "format": dataset.format, |
214 | | - "name": dataset.name, |
215 | | - "location": { |
216 | | - "id": dataset.location.id, |
217 | | - "name": dataset.location.name, |
218 | | - "type": dataset.location.type, |
219 | | - "addresses": [{"url": address.url} for address in dataset.location.addresses], |
220 | | - "external_id": dataset.location.external_id, |
221 | | - }, |
222 | | - }, |
| 175 | + "data": dataset_to_json(dataset), |
223 | 176 | } |
224 | 177 | for dataset in datasets |
225 | 178 | ], |
|
0 commit comments