port-ocean 0.17.8__py3-none-any.whl → 0.18.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of port-ocean might be problematic. Click here for more details.
- port_ocean/clients/port/mixins/entities.py +21 -6
- port_ocean/core/integrations/mixins/sync_raw.py +136 -24
- port_ocean/core/models.py +4 -0
- port_ocean/core/utils/utils.py +80 -4
- port_ocean/tests/core/handlers/mixins/test_sync_raw.py +309 -2
- port_ocean/tests/core/utils/test_resolve_entities_diff.py +559 -0
- {port_ocean-0.17.8.dist-info → port_ocean-0.18.1.dist-info}/METADATA +1 -1
- {port_ocean-0.17.8.dist-info → port_ocean-0.18.1.dist-info}/RECORD +11 -10
- {port_ocean-0.17.8.dist-info → port_ocean-0.18.1.dist-info}/LICENSE.md +0 -0
- {port_ocean-0.17.8.dist-info → port_ocean-0.18.1.dist-info}/WHEEL +0 -0
- {port_ocean-0.17.8.dist-info → port_ocean-0.18.1.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
from unittest.mock import patch
|
|
2
|
+
from port_ocean.core.models import Entity
|
|
3
|
+
from port_ocean.core.utils.utils import (
|
|
4
|
+
are_entities_different,
|
|
5
|
+
resolve_entities_diff,
|
|
6
|
+
are_entities_fields_equal,
|
|
7
|
+
)
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def create_test_entity(
|
|
12
|
+
identifier: str,
|
|
13
|
+
blueprint: str,
|
|
14
|
+
properties: dict[str, Any],
|
|
15
|
+
relations: dict[str, Any],
|
|
16
|
+
title: Any,
|
|
17
|
+
team: str | None | list[Any] = [],
|
|
18
|
+
) -> Entity:
|
|
19
|
+
return Entity(
|
|
20
|
+
identifier=identifier,
|
|
21
|
+
blueprint=blueprint,
|
|
22
|
+
properties=properties,
|
|
23
|
+
relations=relations,
|
|
24
|
+
title=title,
|
|
25
|
+
team=team,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def test_are_entities_fields_equal_identical_properties_should_be_true() -> None:
|
|
30
|
+
assert (
|
|
31
|
+
are_entities_fields_equal(
|
|
32
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 123},
|
|
33
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 123},
|
|
34
|
+
)
|
|
35
|
+
is True
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_are_entities_fields_equal_different_number_properties_should_be_false() -> (
|
|
40
|
+
None
|
|
41
|
+
):
|
|
42
|
+
assert (
|
|
43
|
+
are_entities_fields_equal(
|
|
44
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 123},
|
|
45
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 456},
|
|
46
|
+
)
|
|
47
|
+
is False
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def test_are_entities_fields_equal_different_date_properties_should_be_false() -> None:
|
|
52
|
+
assert (
|
|
53
|
+
are_entities_fields_equal(
|
|
54
|
+
{
|
|
55
|
+
"created_at": "2024-03-20T10:00:00Z",
|
|
56
|
+
"updated_at": "2024-03-21T15:30:00Z",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"created_at": "2024-03-20T10:00:00Z",
|
|
60
|
+
"updated_at": "2024-03-22T09:45:00Z",
|
|
61
|
+
},
|
|
62
|
+
)
|
|
63
|
+
is False
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def test_are_entities_fields_equal_identical_properties_different_order_should_be_true() -> (
|
|
68
|
+
None
|
|
69
|
+
):
|
|
70
|
+
assert (
|
|
71
|
+
are_entities_fields_equal(
|
|
72
|
+
{"totalIssues": 123, "url": "https://test.atlassian.net/browse/test-29081"},
|
|
73
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 123},
|
|
74
|
+
)
|
|
75
|
+
is True
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def test_are_entities_fields_equal_identical_relations_should_be_true() -> None:
|
|
80
|
+
assert (
|
|
81
|
+
are_entities_fields_equal(
|
|
82
|
+
{"reporter": "id1", "project": "project_id"},
|
|
83
|
+
{"reporter": "id1", "project": "project_id"},
|
|
84
|
+
)
|
|
85
|
+
is True
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def test_are_entities_fields_equal_different_relations_should_be_false() -> None:
|
|
90
|
+
assert (
|
|
91
|
+
are_entities_fields_equal(
|
|
92
|
+
{"reporter": "id1", "project": "project_id"},
|
|
93
|
+
{"reporter": "id2", "project": "project_id"},
|
|
94
|
+
)
|
|
95
|
+
is False
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def test_are_entities_fields_equal_different_relation_keys_should_be_false() -> None:
|
|
100
|
+
assert (
|
|
101
|
+
are_entities_fields_equal(
|
|
102
|
+
{"reporter": "id1", "project": "project_id"},
|
|
103
|
+
{"assignee": "id1", "project": "project_id"},
|
|
104
|
+
)
|
|
105
|
+
is False
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def test_are_entities_fields_equal_identical_relations_different_order_should_be_true() -> (
|
|
110
|
+
None
|
|
111
|
+
):
|
|
112
|
+
assert (
|
|
113
|
+
are_entities_fields_equal(
|
|
114
|
+
{"project": "project_id", "reporter": "id1"},
|
|
115
|
+
{"reporter": "id1", "project": "project_id"},
|
|
116
|
+
)
|
|
117
|
+
is True
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def test_are_entities_fields_equal_identical_nested_properties_should_be_true() -> None:
|
|
122
|
+
assert (
|
|
123
|
+
are_entities_fields_equal(
|
|
124
|
+
{
|
|
125
|
+
"metadata": {
|
|
126
|
+
"labels": {"env": "prod", "team": "devops"},
|
|
127
|
+
"annotations": {"description": "test"},
|
|
128
|
+
},
|
|
129
|
+
"spec": {"replicas": 3},
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"metadata": {
|
|
133
|
+
"labels": {"env": "prod", "team": "devops"},
|
|
134
|
+
"annotations": {"description": "test"},
|
|
135
|
+
},
|
|
136
|
+
"spec": {"replicas": 3},
|
|
137
|
+
},
|
|
138
|
+
)
|
|
139
|
+
is True
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def test_are_entities_fields_equal_different_nested_properties_should_be_false() -> (
|
|
144
|
+
None
|
|
145
|
+
):
|
|
146
|
+
assert (
|
|
147
|
+
are_entities_fields_equal(
|
|
148
|
+
{
|
|
149
|
+
"metadata": {
|
|
150
|
+
"labels": {"env": "prod", "team": "devops"},
|
|
151
|
+
"annotations": {"description": "test"},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"metadata": {
|
|
156
|
+
"labels": {"env": "staging", "team": "devops"},
|
|
157
|
+
"annotations": {"description": "test"},
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
)
|
|
161
|
+
is False
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def test_are_entities_fields_equal_identical_nested_arrays_should_be_true() -> None:
|
|
166
|
+
assert (
|
|
167
|
+
are_entities_fields_equal(
|
|
168
|
+
{
|
|
169
|
+
"containers": [
|
|
170
|
+
{"name": "app", "image": "nginx:1.14"},
|
|
171
|
+
{"name": "sidecar", "image": "proxy:2.1"},
|
|
172
|
+
],
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"containers": [
|
|
176
|
+
{"name": "app", "image": "nginx:1.14"},
|
|
177
|
+
{"name": "sidecar", "image": "proxy:2.1"},
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
)
|
|
181
|
+
is True
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def test_are_entities_fields_equal_different_nested_arrays_should_be_false() -> None:
|
|
186
|
+
assert (
|
|
187
|
+
are_entities_fields_equal(
|
|
188
|
+
{
|
|
189
|
+
"containers": [
|
|
190
|
+
{"name": "app", "image": "nginx:1.14"},
|
|
191
|
+
{"name": "sidecar", "image": "proxy:2.1"},
|
|
192
|
+
],
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"containers": [
|
|
196
|
+
{"name": "app", "image": "nginx:1.15"}, # Different version
|
|
197
|
+
{"name": "sidecar", "image": "proxy:2.1"},
|
|
198
|
+
],
|
|
199
|
+
},
|
|
200
|
+
)
|
|
201
|
+
is False
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def test_are_entities_fields_equal_nested_relations_should_be_true() -> None:
|
|
206
|
+
assert (
|
|
207
|
+
are_entities_fields_equal(
|
|
208
|
+
{
|
|
209
|
+
"owner": {
|
|
210
|
+
"team": "team_id1",
|
|
211
|
+
"members": ["user1", "user2"],
|
|
212
|
+
"metadata": {"role": "admin"},
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"owner": {
|
|
217
|
+
"team": "team_id1",
|
|
218
|
+
"members": ["user1", "user2"],
|
|
219
|
+
"metadata": {"role": "admin"},
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
)
|
|
223
|
+
is True
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
def test_are_entities_fields_equal_different_nested_relations_should_be_false() -> None:
|
|
228
|
+
assert (
|
|
229
|
+
are_entities_fields_equal(
|
|
230
|
+
{
|
|
231
|
+
"owner": {
|
|
232
|
+
"team": "team_id1",
|
|
233
|
+
"members": ["user1", "user2"],
|
|
234
|
+
"metadata": {"role": "admin"},
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"owner": {
|
|
239
|
+
"team": "team_id1",
|
|
240
|
+
"members": ["user1", "user3"], # Different member
|
|
241
|
+
"metadata": {"role": "admin"},
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
)
|
|
245
|
+
is False
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
def test_are_entities_different_identical_entities_should_be_false() -> None:
|
|
250
|
+
entity1 = create_test_entity(
|
|
251
|
+
"",
|
|
252
|
+
"",
|
|
253
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 123},
|
|
254
|
+
{"reporter": "id1", "project": "project_id"},
|
|
255
|
+
"",
|
|
256
|
+
"",
|
|
257
|
+
)
|
|
258
|
+
entity2 = create_test_entity(
|
|
259
|
+
"",
|
|
260
|
+
"",
|
|
261
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 123},
|
|
262
|
+
{"reporter": "id1", "project": "project_id"},
|
|
263
|
+
"",
|
|
264
|
+
"",
|
|
265
|
+
)
|
|
266
|
+
assert are_entities_different(entity1, entity2) is False
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
def test_are_entities_different_entities_with_different_properties_should_be_true() -> (
|
|
270
|
+
None
|
|
271
|
+
):
|
|
272
|
+
entity1 = create_test_entity(
|
|
273
|
+
"",
|
|
274
|
+
"",
|
|
275
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 10},
|
|
276
|
+
{"reporter": "id1", "project": "project_id"},
|
|
277
|
+
"",
|
|
278
|
+
"",
|
|
279
|
+
)
|
|
280
|
+
entity2 = create_test_entity(
|
|
281
|
+
"",
|
|
282
|
+
"",
|
|
283
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 123},
|
|
284
|
+
{"reporter": "id1", "project": "project_id"},
|
|
285
|
+
"",
|
|
286
|
+
"",
|
|
287
|
+
)
|
|
288
|
+
assert are_entities_different(entity1, entity2) is True
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
def test_are_entities_different_with_different_relations_should_be_true() -> None:
|
|
292
|
+
entity1 = create_test_entity(
|
|
293
|
+
"",
|
|
294
|
+
"",
|
|
295
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 123},
|
|
296
|
+
{"reporter": "id1", "project": "project_id"},
|
|
297
|
+
"",
|
|
298
|
+
"",
|
|
299
|
+
)
|
|
300
|
+
entity2 = create_test_entity(
|
|
301
|
+
"",
|
|
302
|
+
"",
|
|
303
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 123},
|
|
304
|
+
{"reporter": "id2", "project": "project_id"},
|
|
305
|
+
"",
|
|
306
|
+
"",
|
|
307
|
+
)
|
|
308
|
+
assert are_entities_different(entity1, entity2) is True
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
def test_are_entities_different_with_different_titles_should_be_true() -> None:
|
|
312
|
+
entity1 = create_test_entity(
|
|
313
|
+
"",
|
|
314
|
+
"",
|
|
315
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 123},
|
|
316
|
+
{"reporter": "id1", "project": "project_id"},
|
|
317
|
+
"Issue 123",
|
|
318
|
+
"",
|
|
319
|
+
)
|
|
320
|
+
entity2 = create_test_entity(
|
|
321
|
+
"",
|
|
322
|
+
"",
|
|
323
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 123},
|
|
324
|
+
{"reporter": "id1", "project": "project_id"},
|
|
325
|
+
"Issue 456",
|
|
326
|
+
"",
|
|
327
|
+
)
|
|
328
|
+
assert are_entities_different(entity1, entity2) is True
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
def test_are_entities_different_with_identical_titles_should_be_false() -> None:
|
|
332
|
+
entity1 = create_test_entity(
|
|
333
|
+
"",
|
|
334
|
+
"",
|
|
335
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 123},
|
|
336
|
+
{"reporter": "id1", "project": "project_id"},
|
|
337
|
+
"Issue 123",
|
|
338
|
+
"",
|
|
339
|
+
)
|
|
340
|
+
entity2 = create_test_entity(
|
|
341
|
+
"",
|
|
342
|
+
"",
|
|
343
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 123},
|
|
344
|
+
{"reporter": "id1", "project": "project_id"},
|
|
345
|
+
"Issue 123",
|
|
346
|
+
"",
|
|
347
|
+
)
|
|
348
|
+
assert are_entities_different(entity1, entity2) is False
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
def test_are_entities_different_with_identical_titles_with_emoji_should_be_false() -> (
|
|
352
|
+
None
|
|
353
|
+
):
|
|
354
|
+
entity1 = create_test_entity(
|
|
355
|
+
"",
|
|
356
|
+
"",
|
|
357
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 123},
|
|
358
|
+
{"reporter": "id1", "project": "project_id"},
|
|
359
|
+
"🚀 Issue 123",
|
|
360
|
+
"",
|
|
361
|
+
)
|
|
362
|
+
entity2 = create_test_entity(
|
|
363
|
+
"",
|
|
364
|
+
"",
|
|
365
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 123},
|
|
366
|
+
{"reporter": "id1", "project": "project_id"},
|
|
367
|
+
"🚀 Issue 123",
|
|
368
|
+
"",
|
|
369
|
+
)
|
|
370
|
+
assert are_entities_different(entity1, entity2) is False
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
def test_are_entities_different_with_different_teams_should_be_true() -> None:
|
|
374
|
+
entity1 = create_test_entity(
|
|
375
|
+
"",
|
|
376
|
+
"",
|
|
377
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 123},
|
|
378
|
+
{"reporter": "id1", "project": "project_id"},
|
|
379
|
+
"Issue 123",
|
|
380
|
+
["team1", "team2"],
|
|
381
|
+
)
|
|
382
|
+
entity2 = create_test_entity(
|
|
383
|
+
"",
|
|
384
|
+
"",
|
|
385
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 123},
|
|
386
|
+
{"reporter": "id1", "project": "project_id"},
|
|
387
|
+
"Issue 123",
|
|
388
|
+
["team2", "team3"],
|
|
389
|
+
)
|
|
390
|
+
assert are_entities_different(entity1, entity2) is True
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
def test_are_entities_different_with_identical_teams_different_order_should_be_false() -> (
|
|
394
|
+
None
|
|
395
|
+
):
|
|
396
|
+
entity1 = create_test_entity(
|
|
397
|
+
"",
|
|
398
|
+
"",
|
|
399
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 123},
|
|
400
|
+
{"reporter": "id1", "project": "project_id"},
|
|
401
|
+
"Issue 123",
|
|
402
|
+
["team1", "team2"],
|
|
403
|
+
)
|
|
404
|
+
entity2 = create_test_entity(
|
|
405
|
+
"",
|
|
406
|
+
"",
|
|
407
|
+
{"url": "https://test.atlassian.net/browse/test-29081", "totalIssues": 123},
|
|
408
|
+
{"reporter": "id1", "project": "project_id"},
|
|
409
|
+
"Issue 123",
|
|
410
|
+
["team2", "team1"],
|
|
411
|
+
)
|
|
412
|
+
assert are_entities_different(entity1, entity2) is False
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
entity1 = create_test_entity(
|
|
416
|
+
"id1",
|
|
417
|
+
"bp1",
|
|
418
|
+
{"totalIssues": 123, "url": "https://test.atlassian.net/browse/test-29081"},
|
|
419
|
+
{"reporter": "id1", "project": "project_id"},
|
|
420
|
+
"",
|
|
421
|
+
"",
|
|
422
|
+
)
|
|
423
|
+
entity1_modified_properties = create_test_entity(
|
|
424
|
+
"id1",
|
|
425
|
+
"bp1",
|
|
426
|
+
{"totalIssues": 5, "url": "https://test.atlassian.net/browse/test-29081"},
|
|
427
|
+
{"reporter": "id1", "project": "project_id"},
|
|
428
|
+
"",
|
|
429
|
+
"",
|
|
430
|
+
)
|
|
431
|
+
entity1_modified_relations = create_test_entity(
|
|
432
|
+
"id1",
|
|
433
|
+
"bp1",
|
|
434
|
+
{"totalIssues": 123, "url": "https://test.atlassian.net/browse/test-29081"},
|
|
435
|
+
{"reporter": "id1", "project": "project_id2"},
|
|
436
|
+
"",
|
|
437
|
+
"",
|
|
438
|
+
)
|
|
439
|
+
entity2 = create_test_entity(
|
|
440
|
+
"id2",
|
|
441
|
+
"bp2",
|
|
442
|
+
{"totalIssues": 234, "url": "https://test.atlassian.net/browse/test-23451"},
|
|
443
|
+
{"reporter": "id2", "project": "project_id2"},
|
|
444
|
+
"",
|
|
445
|
+
"",
|
|
446
|
+
)
|
|
447
|
+
entity3 = create_test_entity(
|
|
448
|
+
"id3",
|
|
449
|
+
"bp3",
|
|
450
|
+
{"totalIssues": 20, "url": "https://test.atlassian.net/browse/test-542"},
|
|
451
|
+
{"reporter": "id3", "project": "project_id3"},
|
|
452
|
+
"",
|
|
453
|
+
"",
|
|
454
|
+
)
|
|
455
|
+
entity_with_search_identifier = create_test_entity(
|
|
456
|
+
str(
|
|
457
|
+
{
|
|
458
|
+
"combinator": "and",
|
|
459
|
+
"rules": [
|
|
460
|
+
{"property": "github_username", "operator": "=", "value": "name"}
|
|
461
|
+
],
|
|
462
|
+
}
|
|
463
|
+
),
|
|
464
|
+
"bp3",
|
|
465
|
+
{"totalIssues": 234, "url": "https://test.atlassian.net/browse/test-23451"},
|
|
466
|
+
{"reporter": "id2", "project": "project_id2"},
|
|
467
|
+
"",
|
|
468
|
+
"",
|
|
469
|
+
)
|
|
470
|
+
entity_with_search_relation = create_test_entity(
|
|
471
|
+
"id4",
|
|
472
|
+
"bp4",
|
|
473
|
+
{"totalIssues": 234, "url": "https://test.atlassian.net/browse/test-23451"},
|
|
474
|
+
{
|
|
475
|
+
"reporter": "id2",
|
|
476
|
+
"service_owner": {
|
|
477
|
+
"combinator": "and",
|
|
478
|
+
"rules": [
|
|
479
|
+
{"property": "github_username", "operator": "=", "value": "name"}
|
|
480
|
+
],
|
|
481
|
+
},
|
|
482
|
+
},
|
|
483
|
+
"",
|
|
484
|
+
"",
|
|
485
|
+
)
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
def test_resolve_entities_diff_empty_lists() -> None:
|
|
489
|
+
"""Test when both input lists are empty"""
|
|
490
|
+
changed = resolve_entities_diff([], [])
|
|
491
|
+
assert len(changed) == 0
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
def test_resolve_entities_diff_new_entities() -> None:
|
|
495
|
+
"""Test when there are simple third party entities that are not in Port"""
|
|
496
|
+
changed = resolve_entities_diff([entity1, entity2], [])
|
|
497
|
+
assert len(changed) == 2
|
|
498
|
+
assert changed[0] == entity1
|
|
499
|
+
assert changed[1] == entity2
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
def test_resolve_entities_diff_deleted_entities() -> None:
|
|
503
|
+
"""Test when entities exist in Port but not in third party"""
|
|
504
|
+
changed = resolve_entities_diff([], [entity1, entity2])
|
|
505
|
+
assert len(changed) == 0
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
def test_resolve_entities_diff_identical_entities() -> None:
|
|
509
|
+
"""Test when entities are identical in both sources"""
|
|
510
|
+
changed = resolve_entities_diff([entity1], [entity1])
|
|
511
|
+
assert len(changed) == 0
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
def test_resolve_entities_diff_modified_properties() -> None:
|
|
515
|
+
"""Test when entities exist but have different properties"""
|
|
516
|
+
changed = resolve_entities_diff([entity1_modified_properties], [entity1])
|
|
517
|
+
assert len(changed) == 1
|
|
518
|
+
assert changed[0] == entity1_modified_properties
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
def test_resolve_entities_diff_modified_relations() -> None:
|
|
522
|
+
"""Test when entities exist but have different relations"""
|
|
523
|
+
changed = resolve_entities_diff([entity1_modified_relations], [entity1])
|
|
524
|
+
assert len(changed) == 1
|
|
525
|
+
assert changed[0] == entity1_modified_relations
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
def test_resolve_entities_diff_search_identifier_entity() -> None:
|
|
529
|
+
"""Test when entity uses search identifier"""
|
|
530
|
+
with patch(
|
|
531
|
+
"port_ocean.core.utils.utils.are_entities_different", return_value=False
|
|
532
|
+
) as mock_are_different:
|
|
533
|
+
changed = resolve_entities_diff([entity_with_search_identifier], [])
|
|
534
|
+
assert len(changed) == 1
|
|
535
|
+
assert changed[0] == entity_with_search_identifier
|
|
536
|
+
mock_are_different.assert_not_called()
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
def test_resolve_entities_diff_search_relation_entity() -> None:
|
|
540
|
+
"""Test when entity uses search relation"""
|
|
541
|
+
with patch(
|
|
542
|
+
"port_ocean.core.utils.utils.are_entities_different", return_value=False
|
|
543
|
+
) as mock_are_different:
|
|
544
|
+
changed = resolve_entities_diff([entity_with_search_relation], [])
|
|
545
|
+
assert len(changed) == 1
|
|
546
|
+
assert changed[0] == entity_with_search_relation
|
|
547
|
+
mock_are_different.assert_not_called()
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
def test_resolve_entities_diff_multiple_entities() -> None:
|
|
551
|
+
"""Test with multiple entities in both sources"""
|
|
552
|
+
changed = resolve_entities_diff(
|
|
553
|
+
[entity1_modified_properties, entity2, entity_with_search_identifier],
|
|
554
|
+
[entity1, entity3],
|
|
555
|
+
)
|
|
556
|
+
assert len(changed) == 3
|
|
557
|
+
assert changed[0] == entity1_modified_properties
|
|
558
|
+
assert changed[1] == entity2
|
|
559
|
+
assert changed[2] == entity_with_search_identifier
|
|
@@ -49,7 +49,7 @@ port_ocean/clients/port/authentication.py,sha256=6-uDMWsJ0xLe1-9IoYXHWmwtufj8rJR
|
|
|
49
49
|
port_ocean/clients/port/client.py,sha256=Xd8Jk25Uh4WXY_WW-z1Qbv6F3ZTBFPoOolsxHMfozKw,3366
|
|
50
50
|
port_ocean/clients/port/mixins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
51
51
|
port_ocean/clients/port/mixins/blueprints.py,sha256=POBl4uDocrgJBw4rvCAzwRcD4jk-uBL6pDAuKMTajdg,4633
|
|
52
|
-
port_ocean/clients/port/mixins/entities.py,sha256=
|
|
52
|
+
port_ocean/clients/port/mixins/entities.py,sha256=_aEGE_kGOucw6ZH9qleM5Tjt-YiPAbq9rjSOwcI-py0,10677
|
|
53
53
|
port_ocean/clients/port/mixins/integrations.py,sha256=t8OSa7Iopnpp8IOEcp3a7WgwOcJEBdFow9UbGDKWxKI,4858
|
|
54
54
|
port_ocean/clients/port/mixins/migrations.py,sha256=A6896oJF6WbFL2WroyTkMzr12yhVyWqGoq9dtLNSKBY,1457
|
|
55
55
|
port_ocean/clients/port/retry_transport.py,sha256=PtIZOAZ6V-ncpVysRUsPOgt8Sf01QLnTKB5YeKBxkJk,1861
|
|
@@ -101,12 +101,12 @@ port_ocean/core/integrations/mixins/__init__.py,sha256=FA1FEKMM6P-L2_m7Q4L20mFa4
|
|
|
101
101
|
port_ocean/core/integrations/mixins/events.py,sha256=0jKRsBw6lU8Mqs7MaQK4n-t_H6Z4NEkXZ5VWzqTrKEc,2396
|
|
102
102
|
port_ocean/core/integrations/mixins/handler.py,sha256=mZ7-0UlG3LcrwJttFbMe-R4xcOU2H_g33tZar7PwTv8,3771
|
|
103
103
|
port_ocean/core/integrations/mixins/sync.py,sha256=B9fEs8faaYLLikH9GBjE_E61vo0bQDjIGQsQ1SRXOlA,3931
|
|
104
|
-
port_ocean/core/integrations/mixins/sync_raw.py,sha256=
|
|
104
|
+
port_ocean/core/integrations/mixins/sync_raw.py,sha256=Z76lQuC3zwH5-kYTcR0_mMRF2P9ikuY5Iln_I-vEkR0,24963
|
|
105
105
|
port_ocean/core/integrations/mixins/utils.py,sha256=oN4Okz6xlaefpid1_Pud8HPSw9BwwjRohyNsknq-Myg,2309
|
|
106
|
-
port_ocean/core/models.py,sha256=
|
|
106
|
+
port_ocean/core/models.py,sha256=BDSylTaTMtisvFR2gM6gmRc-387tA0XZSFufKEYdk3A,2115
|
|
107
107
|
port_ocean/core/ocean_types.py,sha256=j_-or1VxDy22whLLxwxgzIsE4wAhFLH19Xff9l4oJA8,1124
|
|
108
108
|
port_ocean/core/utils/entity_topological_sorter.py,sha256=MDUjM6OuDy4Xj68o-7InNN0w1jqjxeDfeY8U02vySNI,3081
|
|
109
|
-
port_ocean/core/utils/utils.py,sha256=
|
|
109
|
+
port_ocean/core/utils/utils.py,sha256=HmumOeH27N0NX1_OP3t4oGKt074ht9XyXhvfZ5I05s4,6474
|
|
110
110
|
port_ocean/debug_cli.py,sha256=gHrv-Ey3cImKOcGZpjoHlo4pa_zfmyOl6TUM4o9VtcA,96
|
|
111
111
|
port_ocean/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
112
112
|
port_ocean/exceptions/api.py,sha256=TLmTMqn4uHGaHgZK8PMIJ0TVJlPB4iP7xl9rx7GtCyY,426
|
|
@@ -133,9 +133,10 @@ port_ocean/tests/clients/port/mixins/test_entities.py,sha256=A9myrnkLhKSQrnOLv1Z
|
|
|
133
133
|
port_ocean/tests/conftest.py,sha256=JXASSS0IY0nnR6bxBflhzxS25kf4iNaABmThyZ0mZt8,101
|
|
134
134
|
port_ocean/tests/core/defaults/test_common.py,sha256=sR7RqB3ZYV6Xn6NIg-c8k5K6JcGsYZ2SCe_PYX5vLYM,5560
|
|
135
135
|
port_ocean/tests/core/handlers/entity_processor/test_jq_entity_processor.py,sha256=FnEnaDjuoAbKvKyv6xJ46n3j0ZcaT70Sg2zc7oy7HAA,13596
|
|
136
|
-
port_ocean/tests/core/handlers/mixins/test_sync_raw.py,sha256
|
|
136
|
+
port_ocean/tests/core/handlers/mixins/test_sync_raw.py,sha256=-qipUqVvXLSdcbDKHOivTMPPaKqC1euQmAhmK4FbFIY,33926
|
|
137
137
|
port_ocean/tests/core/test_utils.py,sha256=Z3kdhb5V7Svhcyy3EansdTpgHL36TL6erNtU-OPwAcI,2647
|
|
138
138
|
port_ocean/tests/core/utils/test_entity_topological_sorter.py,sha256=zuq5WSPy_88PemG3mOUIHTxWMR_js1R7tOzUYlgBd68,3447
|
|
139
|
+
port_ocean/tests/core/utils/test_resolve_entities_diff.py,sha256=4kTey1c0dWKbLXjJ-9m2GXrHyAWZeLQ2asdtYRRUdRs,16573
|
|
139
140
|
port_ocean/tests/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
140
141
|
port_ocean/tests/helpers/fake_port_api.py,sha256=9rtjC6iTQMfzWK6WipkDzzG0b1IIaRmvdJLOyV613vE,6479
|
|
141
142
|
port_ocean/tests/helpers/fixtures.py,sha256=IQEplbHhRgjrAsZlnXrgSYA5YQEn25I9HgO3_Fjibxg,1481
|
|
@@ -157,8 +158,8 @@ port_ocean/utils/repeat.py,sha256=0EFWM9d8lLXAhZmAyczY20LAnijw6UbIECf5lpGbOas,32
|
|
|
157
158
|
port_ocean/utils/signal.py,sha256=K-6kKFQTltcmKDhtyZAcn0IMa3sUpOHGOAUdWKgx0_E,1369
|
|
158
159
|
port_ocean/utils/time.py,sha256=pufAOH5ZQI7gXvOvJoQXZXZJV-Dqktoj9Qp9eiRwmJ4,1939
|
|
159
160
|
port_ocean/version.py,sha256=UsuJdvdQlazzKGD3Hd5-U7N69STh8Dq9ggJzQFnu9fU,177
|
|
160
|
-
port_ocean-0.
|
|
161
|
-
port_ocean-0.
|
|
162
|
-
port_ocean-0.
|
|
163
|
-
port_ocean-0.
|
|
164
|
-
port_ocean-0.
|
|
161
|
+
port_ocean-0.18.1.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
|
162
|
+
port_ocean-0.18.1.dist-info/METADATA,sha256=4Qlj7iIEZMonomhTcA6cQJxC_juC1gJbhBNqRbu8rcg,6669
|
|
163
|
+
port_ocean-0.18.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
164
|
+
port_ocean-0.18.1.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
|
|
165
|
+
port_ocean-0.18.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|