port-ocean 0.19.3__py3-none-any.whl → 0.20.0__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.
@@ -4,62 +4,103 @@ from port_ocean.core.handlers.webhook.webhook_event import (
4
4
  EventHeaders,
5
5
  EventPayload,
6
6
  WebhookEvent,
7
+ LiveEventTimestamp,
7
8
  )
8
9
 
9
10
 
10
- class TestWebhookEvent:
11
- @pytest.fixture
12
- def sample_payload(self) -> EventPayload:
13
- return {"test": "data", "nested": {"value": 123}}
14
-
15
- @pytest.fixture
16
- def sample_headers(self) -> EventHeaders:
17
- return {"content-type": "application/json", "x-test-header": "test-value"}
18
-
19
- @pytest.fixture
20
- def mock_request(
21
- self, sample_payload: EventPayload, sample_headers: EventHeaders
22
- ) -> Request:
23
- scope = {
24
- "type": "http",
25
- "headers": [(k.encode(), v.encode()) for k, v in sample_headers.items()],
26
- }
27
- mock_request = Request(scope)
28
- mock_request._json = sample_payload
29
- return mock_request
30
-
31
- @pytest.fixture
32
- def webhook_event(
33
- self, sample_payload: EventPayload, sample_headers: EventHeaders
34
- ) -> WebhookEvent:
35
- return WebhookEvent(
36
- trace_id="test-trace-id",
37
- payload=sample_payload,
38
- headers=sample_headers,
39
- )
40
-
41
- async def test_create_from_request(self, mock_request: Request) -> None:
42
- """Test creating WebhookEvent from a request."""
43
- event = await WebhookEvent.from_request(mock_request)
44
-
45
- assert event.trace_id is not None
46
- assert len(event.trace_id) > 0
47
- assert event.headers == dict(mock_request.headers)
48
- assert event._original_request == mock_request
49
-
50
- def test_create_from_dict(
51
- self, sample_payload: EventPayload, sample_headers: EventHeaders
52
- ) -> None:
53
- """Test creating WebhookEvent from a dictionary."""
54
- data = {
55
- "trace_id": "test-trace-id",
56
- "payload": sample_payload,
57
- "headers": sample_headers,
58
- }
59
-
60
- event = WebhookEvent.from_dict(data)
61
-
62
- assert event.trace_id == "test-trace-id"
63
- assert event.payload == sample_payload
64
- assert event.headers == sample_headers
65
- assert event._original_request is None
11
+ @pytest.fixture
12
+ def sample_payload() -> EventPayload:
13
+ return {"test": "data", "nested": {"value": 123}}
14
+
15
+
16
+ @pytest.fixture
17
+ def sample_headers() -> EventHeaders:
18
+ return {"content-type": "application/json", "x-test-header": "test-value"}
19
+
20
+
21
+ @pytest.fixture
22
+ def mock_request(sample_payload: EventPayload, sample_headers: EventHeaders) -> Request:
23
+ scope = {
24
+ "type": "http",
25
+ "headers": [(k.encode(), v.encode()) for k, v in sample_headers.items()],
26
+ }
27
+ mock_request = Request(scope)
28
+ mock_request._json = sample_payload
29
+ return mock_request
30
+
31
+
32
+ @pytest.fixture
33
+ def webhook_event(
34
+ sample_payload: EventPayload, sample_headers: EventHeaders
35
+ ) -> WebhookEvent:
36
+ return WebhookEvent(
37
+ trace_id="test-trace-id",
38
+ payload=sample_payload,
39
+ headers=sample_headers,
40
+ )
41
+
42
+
43
+ async def test_fromRequest_createdSuccessfully(mock_request: Request) -> None:
44
+ """Test creating WebhookEvent from a request."""
45
+ event = await WebhookEvent.from_request(mock_request)
46
+
47
+ assert event.trace_id is not None
48
+ assert len(event.trace_id) > 0
49
+ assert event.headers == dict(mock_request.headers)
50
+ assert event._original_request == mock_request
51
+
52
+
53
+ def test_fromDict_createdSuccessfully(
54
+ sample_payload: EventPayload, sample_headers: EventHeaders
55
+ ) -> None:
56
+ """Test creating WebhookEvent from a dictionary."""
57
+ data = {
58
+ "trace_id": "test-trace-id",
59
+ "payload": sample_payload,
60
+ "headers": sample_headers,
61
+ }
62
+
63
+ event = WebhookEvent.from_dict(data)
64
+
65
+ assert event.trace_id == "test-trace-id"
66
+ assert event.payload == sample_payload
67
+ assert event.headers == sample_headers
68
+ assert event._original_request is None
69
+
70
+
71
+ def test_clone_createsExactCopy(
72
+ sample_payload: EventPayload, sample_headers: EventHeaders
73
+ ) -> None:
74
+ """Test cloning a WebhookEvent creates an exact copy."""
75
+ original = WebhookEvent(
76
+ trace_id="test-trace-id",
77
+ payload=sample_payload,
78
+ headers=sample_headers,
79
+ original_request=None,
80
+ )
81
+
82
+ cloned = original.clone()
83
+
84
+ assert cloned.trace_id == original.trace_id
85
+ assert cloned.payload == original.payload
86
+ assert cloned.headers == original.headers
87
+ assert cloned._original_request == original._original_request
88
+ assert cloned is not original # Verify it's a new instance
89
+
90
+
91
+ def test_setTimestamp_setsTimestampCorrectly(
92
+ sample_payload: EventPayload, sample_headers: EventHeaders
93
+ ) -> None:
94
+ """Test that setting a timestamp logs the event and stores the timestamp."""
95
+ event = WebhookEvent(
96
+ trace_id="test-trace-id",
97
+ payload=sample_payload,
98
+ headers=sample_headers,
99
+ original_request=None,
100
+ )
101
+
102
+ event.set_timestamp(LiveEventTimestamp.StartedProcessing)
103
+ assert event._timestamp == LiveEventTimestamp.StartedProcessing
104
+
105
+ event.set_timestamp(LiveEventTimestamp.FinishedProcessingSuccessfully)
106
+ assert event._timestamp == LiveEventTimestamp.FinishedProcessingSuccessfully
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: port-ocean
3
- Version: 0.19.3
3
+ Version: 0.20.0
4
4
  Summary: Port Ocean is a CLI tool for managing your Port projects.
5
5
  Home-page: https://app.getport.io
6
6
  Keywords: ocean,port-ocean,port
@@ -67,7 +67,7 @@ port_ocean/consumers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
67
67
  port_ocean/consumers/kafka_consumer.py,sha256=N8KocjBi9aR0BOPG8hgKovg-ns_ggpEjrSxqSqF_BSo,4710
68
68
  port_ocean/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
69
69
  port_ocean/context/event.py,sha256=QK2ben4fJtxdorq_yRroATttP0DRc4wLtlUJ1as5D58,6208
70
- port_ocean/context/ocean.py,sha256=-T8Z_xcUNMeobr33TTABiOQjxC4KCVvVrP0IytRfen8,6425
70
+ port_ocean/context/ocean.py,sha256=Yt3G9CbcmFhxFTdxUhjkiZSfm92VKmzs7m-BMSGaU54,6316
71
71
  port_ocean/context/resource.py,sha256=yDj63URzQelj8zJPh4BAzTtPhpKr9Gw9DRn7I_0mJ1s,1692
72
72
  port_ocean/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
73
  port_ocean/core/defaults/__init__.py,sha256=8qCZg8n06WAdMu9s_FiRtDYLGPGHbOuS60vapeUoAks,142
@@ -103,14 +103,15 @@ port_ocean/core/handlers/queue/local_queue.py,sha256=EzqsGIX43xbVAcePwTcCg5QDrXA
103
103
  port_ocean/core/handlers/resync_state_updater/__init__.py,sha256=kG6y-JQGpPfuTHh912L_bctIDCzAK4DN-d00S7rguWU,81
104
104
  port_ocean/core/handlers/resync_state_updater/updater.py,sha256=Yg9ET6ZV5B9GW7u6zZA6GlB_71kmvxvYX2FWgQNzMvo,3182
105
105
  port_ocean/core/handlers/webhook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
106
- port_ocean/core/handlers/webhook/abstract_webhook_processor.py,sha256=oZvYgE3rqirx7yN0PAL-9Nls1EHLwOHQaNtFzla3Heo,3500
107
- port_ocean/core/handlers/webhook/processor_manager.py,sha256=B1NjvuWD5MXaW0PWxxOAkbkNfgC9oeuQreusna0EUBA,9166
108
- port_ocean/core/handlers/webhook/webhook_event.py,sha256=9Lk4JzHfgWNruts3pYe-t6OgaG1xP4EkD6lFr_78yUk,2210
106
+ port_ocean/core/handlers/webhook/abstract_webhook_processor.py,sha256=YRMr4M1m0XNZbxNGU0bzB3hEkPat1HCom66EU9NRffU,3879
107
+ port_ocean/core/handlers/webhook/processor_manager.py,sha256=RoPV3cHjAv7jJ_vpC9y2fF2v9eb41h0VM6bNAPuzKdg,11779
108
+ port_ocean/core/handlers/webhook/webhook_event.py,sha256=Iuw6IX3PPjwHECUeFgrJl6K249mJ-DPAGhP8OMxbc1c,4096
109
109
  port_ocean/core/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
110
110
  port_ocean/core/integrations/base.py,sha256=eS0WDOfCTim1UOQQrNuP14I6hvT_fr8dof_cr1ls01s,3107
111
111
  port_ocean/core/integrations/mixins/__init__.py,sha256=FA1FEKMM6P-L2_m7Q4L20mFa4_RgZnwSRmTCreKcBVM,220
112
112
  port_ocean/core/integrations/mixins/events.py,sha256=0jKRsBw6lU8Mqs7MaQK4n-t_H6Z4NEkXZ5VWzqTrKEc,2396
113
113
  port_ocean/core/integrations/mixins/handler.py,sha256=mZ7-0UlG3LcrwJttFbMe-R4xcOU2H_g33tZar7PwTv8,3771
114
+ port_ocean/core/integrations/mixins/live_events.py,sha256=8HklZmlyffYY_LeDe8xbt3Tb08rlLkqVhFF-2NQeJP4,4126
114
115
  port_ocean/core/integrations/mixins/sync.py,sha256=GHiFbnw0XrBfl7aCTH_w67f_N7EZbcUgssc-0fPujNU,4047
115
116
  port_ocean/core/integrations/mixins/sync_raw.py,sha256=7kk2p5lLKq9oivqqintZumuaIHSbcSmoUfWrE346l7g,24821
116
117
  port_ocean/core/integrations/mixins/utils.py,sha256=oN4Okz6xlaefpid1_Pud8HPSw9BwwjRohyNsknq-Myg,2309
@@ -136,7 +137,7 @@ port_ocean/log/handlers.py,sha256=ncVjgqrZRh6BhyRrA6DQG86Wsbxph1yWYuEC0cWfe-Q,36
136
137
  port_ocean/log/logger_setup.py,sha256=CoEDowe5OwNOL_5clU6Z4faktfh0VWaOTS0VLmyhHjw,2404
137
138
  port_ocean/log/sensetive.py,sha256=lVKiZH6b7TkrZAMmhEJRhcl67HNM94e56x12DwFgCQk,2920
138
139
  port_ocean/middlewares.py,sha256=9wYCdyzRZGK1vjEJ28FY_DkfwDNENmXp504UKPf5NaQ,2727
139
- port_ocean/ocean.py,sha256=Gn9xypknv3PkhH6h3bQi2IQLV1TJNPPFiqm0BV0fZ5E,6702
140
+ port_ocean/ocean.py,sha256=qOaTxwQsY_t8rilOAWR2Gl6IWlmbW8QCMHmj8YKWM-Q,6717
140
141
  port_ocean/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
141
142
  port_ocean/run.py,sha256=COoRSmLG4hbsjIW5DzhV0NYVegI9xHd1POv6sg4U1No,2217
142
143
  port_ocean/sonar-project.properties,sha256=X_wLzDOkEVmpGLRMb2fg9Rb0DxWwUFSvESId8qpvrPI,73
@@ -150,13 +151,14 @@ port_ocean/tests/conftest.py,sha256=JXASSS0IY0nnR6bxBflhzxS25kf4iNaABmThyZ0mZt8,
150
151
  port_ocean/tests/core/defaults/test_common.py,sha256=sR7RqB3ZYV6Xn6NIg-c8k5K6JcGsYZ2SCe_PYX5vLYM,5560
151
152
  port_ocean/tests/core/handlers/entities_state_applier/test_applier.py,sha256=R9bqyJocUWTh0NW0s-5ttD_SYYeM5EbYILgVmgWa7qA,2776
152
153
  port_ocean/tests/core/handlers/entity_processor/test_jq_entity_processor.py,sha256=FnEnaDjuoAbKvKyv6xJ46n3j0ZcaT70Sg2zc7oy7HAA,13596
154
+ port_ocean/tests/core/handlers/mixins/test_live_events.py,sha256=iAwVpr3n3PIkXQLw7hxd-iB_SR_vyfletVXJLOmyz28,12480
153
155
  port_ocean/tests/core/handlers/mixins/test_sync_raw.py,sha256=gxQ4e9hQuMS8-o5UbiUSt1I1uaK0DCO3yCFDVigpZvo,31740
154
156
  port_ocean/tests/core/handlers/port_app_config/test_api.py,sha256=eJZ6SuFBLz71y4ca3DNqKag6d6HUjNJS0aqQPwiLMTI,1999
155
157
  port_ocean/tests/core/handlers/port_app_config/test_base.py,sha256=tdjpFUnUZ6TNMxc3trKkzmMTGTb7oKIeu3rRXv_fV3g,6872
156
158
  port_ocean/tests/core/handlers/queue/test_local_queue.py,sha256=9Ly0HzZXbs6Rbl_bstsIdInC3h2bgABU3roP9S_PnJM,2582
157
- port_ocean/tests/core/handlers/webhook/test_abstract_webhook_processor.py,sha256=JbwoC63098xlFPjcNaQEWYaA_SJzUt_x1GS65Yp_M3U,3953
158
- port_ocean/tests/core/handlers/webhook/test_processor_manager.py,sha256=k7ZjegY4qSfkf5uRqdSpc_v8RhObE_20wd1AwrO08Q4,14976
159
- port_ocean/tests/core/handlers/webhook/test_webhook_event.py,sha256=yfsXuJzwEe9WYzyhWwT2IOEwwD9dHtKp_ufREM5v_DI,2090
159
+ port_ocean/tests/core/handlers/webhook/test_abstract_webhook_processor.py,sha256=lLOVjjUCI973d9Ps_hugWOjyxNgEiPjqZVqN3qC2Rhs,3328
160
+ port_ocean/tests/core/handlers/webhook/test_processor_manager.py,sha256=jwoimtQqrzro2Q2wBUmtKWN2bg9013GRpm7LEPCix80,44109
161
+ port_ocean/tests/core/handlers/webhook/test_webhook_event.py,sha256=oR4dEHLO65mp6rkfNfszZcfFoRZlB8ZWee4XetmsuIk,3181
160
162
  port_ocean/tests/core/test_utils.py,sha256=Z3kdhb5V7Svhcyy3EansdTpgHL36TL6erNtU-OPwAcI,2647
161
163
  port_ocean/tests/core/utils/test_entity_topological_sorter.py,sha256=zuq5WSPy_88PemG3mOUIHTxWMR_js1R7tOzUYlgBd68,3447
162
164
  port_ocean/tests/core/utils/test_resolve_entities_diff.py,sha256=4kTey1c0dWKbLXjJ-9m2GXrHyAWZeLQ2asdtYRRUdRs,16573
@@ -182,8 +184,8 @@ port_ocean/utils/repeat.py,sha256=U2OeCkHPWXmRTVoPV-VcJRlQhcYqPWI5NfmPlb1JIbc,32
182
184
  port_ocean/utils/signal.py,sha256=mMVq-1Ab5YpNiqN4PkiyTGlV_G0wkUDMMjTZp5z3pb0,1514
183
185
  port_ocean/utils/time.py,sha256=pufAOH5ZQI7gXvOvJoQXZXZJV-Dqktoj9Qp9eiRwmJ4,1939
184
186
  port_ocean/version.py,sha256=UsuJdvdQlazzKGD3Hd5-U7N69STh8Dq9ggJzQFnu9fU,177
185
- port_ocean-0.19.3.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
186
- port_ocean-0.19.3.dist-info/METADATA,sha256=CPF-LXS--mI2bv0nA2y4OZZsZFN8g7uE7APaTf5vBto,6669
187
- port_ocean-0.19.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
188
- port_ocean-0.19.3.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
189
- port_ocean-0.19.3.dist-info/RECORD,,
187
+ port_ocean-0.20.0.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
188
+ port_ocean-0.20.0.dist-info/METADATA,sha256=X2MxnIa5HHfiETogtSckUoMZWkCGlOyBpemPDuqQLfs,6669
189
+ port_ocean-0.20.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
190
+ port_ocean-0.20.0.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
191
+ port_ocean-0.20.0.dist-info/RECORD,,