port-ocean 0.11.0__py3-none-any.whl → 0.12.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.
Potentially problematic release.
This version of port-ocean might be problematic. Click here for more details.
- port_ocean/log/sensetive.py +1 -1
- port_ocean/tests/helpers/fixtures.py +13 -91
- port_ocean/tests/helpers/integration.py +31 -0
- port_ocean/tests/helpers/port_client.py +21 -0
- port_ocean/tests/helpers/smoke_test.py +82 -0
- port_ocean/tests/test_smoke.py +1 -1
- {port_ocean-0.11.0.dist-info → port_ocean-0.12.0.dist-info}/METADATA +1 -1
- {port_ocean-0.11.0.dist-info → port_ocean-0.12.0.dist-info}/RECORD +11 -8
- {port_ocean-0.11.0.dist-info → port_ocean-0.12.0.dist-info}/LICENSE.md +0 -0
- {port_ocean-0.11.0.dist-info → port_ocean-0.12.0.dist-info}/WHEEL +0 -0
- {port_ocean-0.11.0.dist-info → port_ocean-0.12.0.dist-info}/entry_points.txt +0 -0
port_ocean/log/sensetive.py
CHANGED
|
@@ -21,7 +21,7 @@ secret_patterns = {
|
|
|
21
21
|
"GitHub": r"[g|G][i|I][t|T][h|H][u|U][b|B].*['|\"][0-9a-zA-Z]{35,40}['|\"]",
|
|
22
22
|
"Google Cloud Platform API Key": r"AIza[0-9A-Za-z\\-_]{35}",
|
|
23
23
|
"Google Cloud Platform OAuth": r"[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com",
|
|
24
|
-
"Google (GCP) Service-account":
|
|
24
|
+
"Google (GCP) Service-account": f'"type":{" "}"service_account"',
|
|
25
25
|
"Google OAuth Access Token": r"ya29\\.[0-9A-Za-z\\-_]+",
|
|
26
26
|
"Connection String": r"[a-zA-Z]+:\/\/[^/\s]+:[^/\s]+@[^/\s]+\/[^/\s]+",
|
|
27
27
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
from os import
|
|
2
|
-
from typing import Any,
|
|
1
|
+
from os import path
|
|
2
|
+
from typing import Any, Callable, List, Tuple
|
|
3
3
|
|
|
4
|
+
import pytest
|
|
4
5
|
import pytest_asyncio
|
|
5
|
-
from loguru import logger
|
|
6
|
-
from pydantic import BaseModel
|
|
7
6
|
|
|
8
7
|
from port_ocean.clients.port.client import PortClient
|
|
9
8
|
from port_ocean.core.handlers.port_app_config.models import ResourceConfig
|
|
@@ -12,96 +11,19 @@ from port_ocean.tests.helpers.ocean_app import (
|
|
|
12
11
|
get_integation_resource_configs,
|
|
13
12
|
get_integration_ocean_app,
|
|
14
13
|
)
|
|
14
|
+
from port_ocean.tests.helpers.smoke_test import (
|
|
15
|
+
SmokeTestDetails,
|
|
16
|
+
get_port_client_for_fake_integration,
|
|
17
|
+
get_smoke_test_details,
|
|
18
|
+
)
|
|
15
19
|
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
integration_type: str,
|
|
22
|
-
integration_version: str,
|
|
23
|
-
base_url: Union[str, None],
|
|
24
|
-
) -> PortClient:
|
|
25
|
-
return PortClient(
|
|
26
|
-
base_url=base_url or "https://api.getport/io",
|
|
27
|
-
client_id=client_id,
|
|
28
|
-
client_secret=client_secret,
|
|
29
|
-
integration_identifier=integration_identifier,
|
|
30
|
-
integration_type=integration_type,
|
|
31
|
-
integration_version=integration_version,
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
async def cleanup_integration(client: PortClient, blueprints: List[str]) -> None:
|
|
36
|
-
for blueprint in blueprints:
|
|
37
|
-
try:
|
|
38
|
-
bp = await client.get_blueprint(blueprint)
|
|
39
|
-
if bp is not None:
|
|
40
|
-
migration_id = await client.delete_blueprint(
|
|
41
|
-
identifier=blueprint, delete_entities=True
|
|
42
|
-
)
|
|
43
|
-
if migration_id:
|
|
44
|
-
await client.wait_for_migration_to_complete(
|
|
45
|
-
migration_id=migration_id
|
|
46
|
-
)
|
|
47
|
-
except Exception as bp_e:
|
|
48
|
-
logger.info(f"Skipping missing blueprint ({blueprint}): {bp_e}")
|
|
49
|
-
headers = await client.auth.headers()
|
|
50
|
-
try:
|
|
51
|
-
await client.client.delete(
|
|
52
|
-
f"{client.auth.api_url}/integrations/{client.integration_identifier}",
|
|
53
|
-
headers=headers,
|
|
54
|
-
)
|
|
55
|
-
except Exception as int_e:
|
|
56
|
-
logger.info(
|
|
57
|
-
f"Failed to delete integration ({client.integration_identifier}): {int_e}"
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
class SmokeTestDetails(BaseModel):
|
|
62
|
-
integration_identifier: str
|
|
63
|
-
blueprint_department: str
|
|
64
|
-
blueprint_person: str
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
@pytest_asyncio.fixture()
|
|
68
|
-
async def port_client_for_fake_integration() -> (
|
|
69
|
-
AsyncGenerator[Tuple[SmokeTestDetails, PortClient], None]
|
|
70
|
-
):
|
|
71
|
-
blueprint_department = "fake-department"
|
|
72
|
-
blueprint_person = "fake-person"
|
|
73
|
-
integration_identifier = "smoke-test-integration"
|
|
74
|
-
smoke_test_suffix = environ.get("SMOKE_TEST_SUFFIX")
|
|
75
|
-
client_id = environ.get("PORT_CLIENT_ID")
|
|
76
|
-
client_secret = environ.get("PORT_CLIENT_SECRET")
|
|
77
|
-
|
|
78
|
-
if not client_secret or not client_id:
|
|
79
|
-
assert False, "Missing port credentials"
|
|
80
|
-
|
|
81
|
-
base_url = environ.get("PORT_BASE_URL")
|
|
82
|
-
integration_version = "0.1.1-dev"
|
|
83
|
-
integration_type = "smoke-test"
|
|
84
|
-
if smoke_test_suffix is not None:
|
|
85
|
-
integration_identifier = f"{integration_identifier}-{smoke_test_suffix}"
|
|
86
|
-
blueprint_person = f"{blueprint_person}-{smoke_test_suffix}"
|
|
87
|
-
blueprint_department = f"{blueprint_department}-{smoke_test_suffix}"
|
|
88
|
-
|
|
89
|
-
client = get_port_client_for_integration(
|
|
90
|
-
client_id,
|
|
91
|
-
client_secret,
|
|
92
|
-
integration_identifier,
|
|
93
|
-
integration_type,
|
|
94
|
-
integration_version,
|
|
95
|
-
base_url,
|
|
96
|
-
)
|
|
21
|
+
@pytest.fixture
|
|
22
|
+
def port_client_for_fake_integration() -> Tuple[SmokeTestDetails, PortClient]:
|
|
23
|
+
smoke_test_details = get_smoke_test_details()
|
|
24
|
+
port_client = get_port_client_for_fake_integration()
|
|
97
25
|
|
|
98
|
-
smoke_test_details
|
|
99
|
-
integration_identifier=integration_identifier,
|
|
100
|
-
blueprint_person=blueprint_person,
|
|
101
|
-
blueprint_department=blueprint_department,
|
|
102
|
-
)
|
|
103
|
-
yield smoke_test_details, client
|
|
104
|
-
await cleanup_integration(client, [blueprint_department, blueprint_person])
|
|
26
|
+
return smoke_test_details, port_client
|
|
105
27
|
|
|
106
28
|
|
|
107
29
|
@pytest_asyncio.fixture
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
from loguru import logger
|
|
4
|
+
|
|
5
|
+
from port_ocean.clients.port.client import PortClient
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
async def cleanup_integration(client: PortClient, blueprints: List[str]) -> None:
|
|
9
|
+
for blueprint in blueprints:
|
|
10
|
+
try:
|
|
11
|
+
bp = await client.get_blueprint(blueprint)
|
|
12
|
+
if bp is not None:
|
|
13
|
+
migration_id = await client.delete_blueprint(
|
|
14
|
+
identifier=blueprint, delete_entities=True
|
|
15
|
+
)
|
|
16
|
+
if migration_id:
|
|
17
|
+
await client.wait_for_migration_to_complete(
|
|
18
|
+
migration_id=migration_id
|
|
19
|
+
)
|
|
20
|
+
except Exception as bp_e:
|
|
21
|
+
logger.info(f"Skipping missing blueprint ({blueprint}): {bp_e}")
|
|
22
|
+
headers = await client.auth.headers()
|
|
23
|
+
try:
|
|
24
|
+
await client.client.delete(
|
|
25
|
+
f"{client.auth.api_url}/integrations/{client.integration_identifier}",
|
|
26
|
+
headers=headers,
|
|
27
|
+
)
|
|
28
|
+
except Exception as int_e:
|
|
29
|
+
logger.info(
|
|
30
|
+
f"Failed to delete integration ({client.integration_identifier}): {int_e}"
|
|
31
|
+
)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from typing import Union
|
|
2
|
+
|
|
3
|
+
from port_ocean.clients.port.client import PortClient
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def get_port_client_for_integration(
|
|
7
|
+
client_id: str,
|
|
8
|
+
client_secret: str,
|
|
9
|
+
integration_identifier: str,
|
|
10
|
+
integration_type: str,
|
|
11
|
+
integration_version: str,
|
|
12
|
+
base_url: Union[str, None],
|
|
13
|
+
) -> PortClient:
|
|
14
|
+
return PortClient(
|
|
15
|
+
base_url=base_url or "https://api.getport/io",
|
|
16
|
+
client_id=client_id,
|
|
17
|
+
client_secret=client_secret,
|
|
18
|
+
integration_identifier=integration_identifier,
|
|
19
|
+
integration_type=integration_type,
|
|
20
|
+
integration_version=integration_version,
|
|
21
|
+
)
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
from os import environ
|
|
2
|
+
from port_ocean.clients.port.client import PortClient
|
|
3
|
+
|
|
4
|
+
from loguru import logger
|
|
5
|
+
from pydantic import BaseModel
|
|
6
|
+
|
|
7
|
+
from port_ocean.tests.helpers.integration import cleanup_integration
|
|
8
|
+
from port_ocean.tests.helpers.port_client import get_port_client_for_integration
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SmokeTestDetails(BaseModel):
|
|
12
|
+
integration_identifier: str
|
|
13
|
+
blueprint_department: str
|
|
14
|
+
blueprint_person: str
|
|
15
|
+
integration_type: str
|
|
16
|
+
integration_version: str
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def get_smoke_test_details() -> SmokeTestDetails:
|
|
20
|
+
blueprint_department = "fake-department"
|
|
21
|
+
blueprint_person = "fake-person"
|
|
22
|
+
integration_identifier = "smoke-test-integration"
|
|
23
|
+
smoke_test_suffix = environ.get("SMOKE_TEST_SUFFIX")
|
|
24
|
+
if smoke_test_suffix is not None:
|
|
25
|
+
integration_identifier = f"{integration_identifier}-{smoke_test_suffix}"
|
|
26
|
+
blueprint_person = f"{blueprint_person}-{smoke_test_suffix}"
|
|
27
|
+
blueprint_department = f"{blueprint_department}-{smoke_test_suffix}"
|
|
28
|
+
|
|
29
|
+
return SmokeTestDetails(
|
|
30
|
+
integration_identifier=integration_identifier,
|
|
31
|
+
blueprint_person=blueprint_person,
|
|
32
|
+
blueprint_department=blueprint_department,
|
|
33
|
+
integration_version="0.1.4-dev",
|
|
34
|
+
integration_type="smoke-test",
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
async def cleanup_smoke_test() -> None:
|
|
39
|
+
smoke_test_details = get_smoke_test_details()
|
|
40
|
+
client_id = environ.get("PORT_CLIENT_ID")
|
|
41
|
+
client_secret = environ.get("PORT_CLIENT_SECRET")
|
|
42
|
+
|
|
43
|
+
if not client_secret or not client_id:
|
|
44
|
+
assert False, "Missing port credentials"
|
|
45
|
+
|
|
46
|
+
base_url = environ.get("PORT_BASE_URL")
|
|
47
|
+
client = get_port_client_for_integration(
|
|
48
|
+
client_id,
|
|
49
|
+
client_secret,
|
|
50
|
+
smoke_test_details.integration_identifier,
|
|
51
|
+
smoke_test_details.integration_type,
|
|
52
|
+
smoke_test_details.integration_version,
|
|
53
|
+
base_url,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
logger.info("Cleaning up fake integration")
|
|
57
|
+
await cleanup_integration(
|
|
58
|
+
client,
|
|
59
|
+
[smoke_test_details.blueprint_department, smoke_test_details.blueprint_person],
|
|
60
|
+
)
|
|
61
|
+
logger.info("Cleaning up fake integration complete")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def get_port_client_for_fake_integration() -> PortClient:
|
|
65
|
+
smoke_test_details = get_smoke_test_details()
|
|
66
|
+
client_id = environ.get("PORT_CLIENT_ID")
|
|
67
|
+
client_secret = environ.get("PORT_CLIENT_SECRET")
|
|
68
|
+
|
|
69
|
+
if not client_secret or not client_id:
|
|
70
|
+
assert False, "Missing port credentials"
|
|
71
|
+
|
|
72
|
+
base_url = environ.get("PORT_BASE_URL")
|
|
73
|
+
client = get_port_client_for_integration(
|
|
74
|
+
client_id,
|
|
75
|
+
client_secret,
|
|
76
|
+
smoke_test_details.integration_identifier,
|
|
77
|
+
smoke_test_details.integration_type,
|
|
78
|
+
smoke_test_details.integration_version,
|
|
79
|
+
base_url,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
return client
|
port_ocean/tests/test_smoke.py
CHANGED
|
@@ -4,7 +4,7 @@ import pytest
|
|
|
4
4
|
|
|
5
5
|
from port_ocean.clients.port.client import PortClient
|
|
6
6
|
from port_ocean.clients.port.types import UserAgentType
|
|
7
|
-
from port_ocean.tests.helpers.
|
|
7
|
+
from port_ocean.tests.helpers.smoke_test import SmokeTestDetails
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
pytestmark = pytest.mark.smoke
|
|
@@ -113,7 +113,7 @@ port_ocean/helpers/retry.py,sha256=IQ0RfQ2T5o6uoZh2WW2nrFH5TT6K_k3y2Im0HDp5j9Y,1
|
|
|
113
113
|
port_ocean/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
114
114
|
port_ocean/log/handlers.py,sha256=k9G_Mb4ga2-Jke9irpdlYqj6EYiwv0gEsh4TgyqqOmI,2853
|
|
115
115
|
port_ocean/log/logger_setup.py,sha256=BaXt-mh9CVXhneh37H46d04lqOdIBixG1pFyGfotuZs,2328
|
|
116
|
-
port_ocean/log/sensetive.py,sha256=
|
|
116
|
+
port_ocean/log/sensetive.py,sha256=lVKiZH6b7TkrZAMmhEJRhcl67HNM94e56x12DwFgCQk,2920
|
|
117
117
|
port_ocean/middlewares.py,sha256=9wYCdyzRZGK1vjEJ28FY_DkfwDNENmXp504UKPf5NaQ,2727
|
|
118
118
|
port_ocean/ocean.py,sha256=Oe4H3kKtkj52uNO4Rd_47iY3MBdrTtshXZ_16q7A8bM,5071
|
|
119
119
|
port_ocean/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -124,9 +124,12 @@ port_ocean/tests/clients/port/mixins/test_entities.py,sha256=A9myrnkLhKSQrnOLv1Z
|
|
|
124
124
|
port_ocean/tests/conftest.py,sha256=JXASSS0IY0nnR6bxBflhzxS25kf4iNaABmThyZ0mZt8,101
|
|
125
125
|
port_ocean/tests/core/handlers/entity_processor/test_jq_entity_processor.py,sha256=fqhlLTFkP0SS12bqViYWgqayNGXWZhqpDSJObHVRnNg,9472
|
|
126
126
|
port_ocean/tests/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
127
|
-
port_ocean/tests/helpers/fixtures.py,sha256=
|
|
127
|
+
port_ocean/tests/helpers/fixtures.py,sha256=blc4ZgPEkKOmmwT6GVxceS9r1ERUwSdOIBGxWFwvRyY,1398
|
|
128
|
+
port_ocean/tests/helpers/integration.py,sha256=_RxS-RHpu11lrbhUXYPZp862HLWx8AoD7iZM6iXN8rs,1104
|
|
128
129
|
port_ocean/tests/helpers/ocean_app.py,sha256=Dp1bwEDhWsx_G-KVxOfJX1eVIS4168ajLu39wAY275g,1693
|
|
129
|
-
port_ocean/tests/
|
|
130
|
+
port_ocean/tests/helpers/port_client.py,sha256=5d6GNr8vNNSOkrz1AdOhxBUKuusr_-UPDP7AVpHasQw,599
|
|
131
|
+
port_ocean/tests/helpers/smoke_test.py,sha256=_9aJJFRfuGJEg2D2YQJVJRmpreS6gEPHHQq8Q01x4aQ,2697
|
|
132
|
+
port_ocean/tests/test_smoke.py,sha256=uix2uIg_yOm8BHDgHw2hTFPy1fiIyxBGW3ENU_KoFlo,2557
|
|
130
133
|
port_ocean/utils/__init__.py,sha256=KMGnCPXZJbNwtgxtyMycapkDz8tpSyw23MSYT3iVeHs,91
|
|
131
134
|
port_ocean/utils/async_http.py,sha256=arnH458TExn2Dju_Sy6pHas_vF5RMWnOp-jBz5WAAcE,1226
|
|
132
135
|
port_ocean/utils/async_iterators.py,sha256=iw3cUHxfQm3zUSPdw2FmSXDU8E1Ppnys4TGhswNuQ8s,1569
|
|
@@ -137,8 +140,8 @@ port_ocean/utils/repeat.py,sha256=0EFWM9d8lLXAhZmAyczY20LAnijw6UbIECf5lpGbOas,32
|
|
|
137
140
|
port_ocean/utils/signal.py,sha256=K-6kKFQTltcmKDhtyZAcn0IMa3sUpOHGOAUdWKgx0_E,1369
|
|
138
141
|
port_ocean/utils/time.py,sha256=pufAOH5ZQI7gXvOvJoQXZXZJV-Dqktoj9Qp9eiRwmJ4,1939
|
|
139
142
|
port_ocean/version.py,sha256=UsuJdvdQlazzKGD3Hd5-U7N69STh8Dq9ggJzQFnu9fU,177
|
|
140
|
-
port_ocean-0.
|
|
141
|
-
port_ocean-0.
|
|
142
|
-
port_ocean-0.
|
|
143
|
-
port_ocean-0.
|
|
144
|
-
port_ocean-0.
|
|
143
|
+
port_ocean-0.12.0.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
|
144
|
+
port_ocean-0.12.0.dist-info/METADATA,sha256=PrJZo5rBOy6h2_slD1tjSHcTdHCc-PgyIsk9DNqk0pY,6614
|
|
145
|
+
port_ocean-0.12.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
146
|
+
port_ocean-0.12.0.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
|
|
147
|
+
port_ocean-0.12.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|