port-ocean 0.10.10__tar.gz → 0.10.12__tar.gz

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.

Files changed (143) hide show
  1. {port_ocean-0.10.10 → port_ocean-0.10.12}/PKG-INFO +1 -1
  2. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/integrations/mixins/sync_raw.py +3 -1
  3. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/ocean.py +4 -0
  4. port_ocean-0.10.12/port_ocean/tests/conftest.py +4 -0
  5. port_ocean-0.10.12/port_ocean/tests/helpers/__init__.py +0 -0
  6. port_ocean-0.10.12/port_ocean/tests/helpers/fixtures.py +110 -0
  7. port_ocean-0.10.10/port_ocean/tests/helpers/__init__.py → port_ocean-0.10.12/port_ocean/tests/helpers/ocean_app.py +6 -32
  8. port_ocean-0.10.12/port_ocean/tests/test_smoke.py +71 -0
  9. {port_ocean-0.10.10 → port_ocean-0.10.12}/pyproject.toml +1 -1
  10. {port_ocean-0.10.10 → port_ocean-0.10.12}/LICENSE.md +0 -0
  11. {port_ocean-0.10.10 → port_ocean-0.10.12}/README.md +0 -0
  12. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/__init__.py +0 -0
  13. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/bootstrap.py +0 -0
  14. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/__init__.py +0 -0
  15. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cli.py +0 -0
  16. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/commands/__init__.py +0 -0
  17. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/commands/defaults/__init___.py +0 -0
  18. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/commands/defaults/clean.py +0 -0
  19. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/commands/defaults/dock.py +0 -0
  20. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/commands/defaults/group.py +0 -0
  21. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/commands/list_integrations.py +0 -0
  22. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/commands/main.py +0 -0
  23. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/commands/new.py +0 -0
  24. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/commands/pull.py +0 -0
  25. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/commands/sail.py +0 -0
  26. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/commands/version.py +0 -0
  27. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/__init__.py +0 -0
  28. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/cookiecutter.json +0 -0
  29. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/extensions.py +0 -0
  30. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/hooks/post_gen_project.py +0 -0
  31. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/.dockerignore +0 -0
  32. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/.env.example +0 -0
  33. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/.gitignore +0 -0
  34. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/.port/resources/.gitignore +0 -0
  35. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/.port/resources/blueprints.json +0 -0
  36. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/.port/resources/port-app-config.yml +0 -0
  37. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/.port/spec.yaml +0 -0
  38. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/CHANGELOG.md +0 -0
  39. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/CONTRIBUTING.md +0 -0
  40. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/Dockerfile +0 -0
  41. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/README.md +0 -0
  42. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/changelog/.gitignore +0 -0
  43. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/debug.py +0 -0
  44. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/main.py +0 -0
  45. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/poetry.toml +0 -0
  46. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/pyproject.toml +0 -0
  47. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/sonar-project.properties +0 -0
  48. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/tests/__init__.py +0 -0
  49. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/tests/test_sample.py +0 -0
  50. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/cli/utils.py +0 -0
  51. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/clients/__init__.py +0 -0
  52. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/clients/port/__init__.py +0 -0
  53. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/clients/port/authentication.py +0 -0
  54. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/clients/port/client.py +0 -0
  55. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/clients/port/mixins/__init__.py +0 -0
  56. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/clients/port/mixins/blueprints.py +0 -0
  57. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/clients/port/mixins/entities.py +0 -0
  58. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/clients/port/mixins/integrations.py +0 -0
  59. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/clients/port/mixins/migrations.py +0 -0
  60. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/clients/port/retry_transport.py +0 -0
  61. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/clients/port/types.py +0 -0
  62. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/clients/port/utils.py +0 -0
  63. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/config/__init__.py +0 -0
  64. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/config/base.py +0 -0
  65. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/config/dynamic.py +0 -0
  66. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/config/settings.py +0 -0
  67. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/consumers/__init__.py +0 -0
  68. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/consumers/kafka_consumer.py +0 -0
  69. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/context/__init__.py +0 -0
  70. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/context/event.py +0 -0
  71. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/context/ocean.py +0 -0
  72. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/context/resource.py +0 -0
  73. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/__init__.py +0 -0
  74. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/defaults/__init__.py +0 -0
  75. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/defaults/clean.py +0 -0
  76. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/defaults/common.py +0 -0
  77. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/defaults/initialize.py +0 -0
  78. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/event_listener/__init__.py +0 -0
  79. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/event_listener/base.py +0 -0
  80. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/event_listener/factory.py +0 -0
  81. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/event_listener/http.py +0 -0
  82. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/event_listener/kafka.py +0 -0
  83. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/event_listener/once.py +0 -0
  84. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/event_listener/polling.py +0 -0
  85. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/handlers/__init__.py +0 -0
  86. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/handlers/base.py +0 -0
  87. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/handlers/entities_state_applier/__init__.py +0 -0
  88. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/handlers/entities_state_applier/base.py +0 -0
  89. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/handlers/entities_state_applier/port/__init__.py +0 -0
  90. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/handlers/entities_state_applier/port/applier.py +0 -0
  91. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/handlers/entities_state_applier/port/get_related_entities.py +0 -0
  92. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/handlers/entities_state_applier/port/order_by_entities_dependencies.py +0 -0
  93. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/handlers/entity_processor/__init__.py +0 -0
  94. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/handlers/entity_processor/base.py +0 -0
  95. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/handlers/entity_processor/jq_entity_processor.py +0 -0
  96. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/handlers/port_app_config/__init__.py +0 -0
  97. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/handlers/port_app_config/api.py +0 -0
  98. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/handlers/port_app_config/base.py +0 -0
  99. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/handlers/port_app_config/models.py +0 -0
  100. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/handlers/resync_state_updater/__init__.py +0 -0
  101. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/handlers/resync_state_updater/updater.py +0 -0
  102. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/integrations/__init__.py +0 -0
  103. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/integrations/base.py +0 -0
  104. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/integrations/mixins/__init__.py +0 -0
  105. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/integrations/mixins/events.py +0 -0
  106. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/integrations/mixins/handler.py +0 -0
  107. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/integrations/mixins/sync.py +0 -0
  108. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/integrations/mixins/utils.py +0 -0
  109. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/models.py +0 -0
  110. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/ocean_types.py +0 -0
  111. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/core/utils.py +0 -0
  112. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/exceptions/__init__.py +0 -0
  113. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/exceptions/api.py +0 -0
  114. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/exceptions/base.py +0 -0
  115. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/exceptions/clients.py +0 -0
  116. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/exceptions/context.py +0 -0
  117. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/exceptions/core.py +0 -0
  118. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/exceptions/port_defaults.py +0 -0
  119. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/exceptions/utils.py +0 -0
  120. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/helpers/__init__.py +0 -0
  121. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/helpers/async_client.py +0 -0
  122. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/helpers/retry.py +0 -0
  123. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/log/__init__.py +0 -0
  124. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/log/handlers.py +0 -0
  125. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/log/logger_setup.py +0 -0
  126. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/log/sensetive.py +0 -0
  127. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/middlewares.py +0 -0
  128. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/py.typed +0 -0
  129. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/run.py +0 -0
  130. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/sonar-project.properties +0 -0
  131. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/tests/__init__.py +0 -0
  132. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/tests/clients/port/mixins/test_entities.py +0 -0
  133. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/tests/test_sample.py +0 -0
  134. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/utils/__init__.py +0 -0
  135. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/utils/async_http.py +0 -0
  136. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/utils/async_iterators.py +0 -0
  137. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/utils/cache.py +0 -0
  138. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/utils/misc.py +0 -0
  139. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/utils/queue_utils.py +0 -0
  140. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/utils/repeat.py +0 -0
  141. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/utils/signal.py +0 -0
  142. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/utils/time.py +0 -0
  143. {port_ocean-0.10.10 → port_ocean-0.10.12}/port_ocean/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: port-ocean
3
- Version: 0.10.10
3
+ Version: 0.10.12
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
@@ -456,7 +456,8 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
456
456
 
457
457
  creation_results.append(await task)
458
458
  except asyncio.CancelledError as e:
459
- logger.warning("Resync aborted successfully")
459
+ logger.warning("Resync aborted successfully, skipping delete phase. This leads to an incomplete state")
460
+ raise
460
461
  else:
461
462
  if not did_fetched_current_state:
462
463
  logger.warning(
@@ -489,3 +490,4 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
489
490
  {"before": entities_at_port, "after": flat_created_entities},
490
491
  user_agent_type,
491
492
  )
493
+ logger.info("Resync finished successfully")
@@ -82,6 +82,10 @@ class Ocean:
82
82
  try:
83
83
  await self.integration.sync_raw_all()
84
84
  await self.resync_state_updater.update_after_resync()
85
+ except asyncio.CancelledError:
86
+ logger.warning(
87
+ "resync was cancelled by the scheduled resync, skipping state update"
88
+ )
85
89
  except Exception as e:
86
90
  await self.resync_state_updater.update_after_resync(
87
91
  IntegrationStateStatus.Failed
@@ -0,0 +1,4 @@
1
+ # ruff: noqa
2
+ from port_ocean.tests.helpers.fixtures import (
3
+ port_client_for_fake_integration,
4
+ )
@@ -0,0 +1,110 @@
1
+ from os import environ, path
2
+ from typing import Any, AsyncGenerator, Callable, List, Tuple, Union
3
+
4
+ import pytest_asyncio
5
+ from pydantic import BaseModel
6
+
7
+ from port_ocean.clients.port.client import PortClient
8
+ from port_ocean.core.handlers.port_app_config.models import ResourceConfig
9
+ from port_ocean.ocean import Ocean
10
+ from port_ocean.tests.helpers.ocean_app import (
11
+ get_integation_resource_configs,
12
+ get_integration_ocean_app,
13
+ )
14
+
15
+
16
+ def get_port_client_for_integration(
17
+ client_id: str,
18
+ client_secret: str,
19
+ integration_identifier: str,
20
+ integration_type: str,
21
+ integration_version: str,
22
+ base_url: Union[str, None],
23
+ ) -> PortClient:
24
+ return PortClient(
25
+ base_url=base_url or "https://api.getport/io",
26
+ client_id=client_id,
27
+ client_secret=client_secret,
28
+ integration_identifier=integration_identifier,
29
+ integration_type=integration_type,
30
+ integration_version=integration_version,
31
+ )
32
+
33
+
34
+ async def cleanup_integration(client: PortClient, blueprints: List[str]) -> None:
35
+ for blueprint in blueprints:
36
+ bp = await client.get_blueprint(blueprint)
37
+ if bp is not None:
38
+ migration_id = await client.delete_blueprint(
39
+ identifier=blueprint, delete_entities=True
40
+ )
41
+ if migration_id:
42
+ await client.wait_for_migration_to_complete(migration_id=migration_id)
43
+ headers = await client.auth.headers()
44
+ await client.client.delete(f"{client.auth.api_url}/integrations", headers=headers)
45
+
46
+
47
+ class SmokeTestDetails(BaseModel):
48
+ integration_identifier: str
49
+ blueprint_department: str
50
+ blueprint_person: str
51
+
52
+
53
+ @pytest_asyncio.fixture()
54
+ async def port_client_for_fake_integration() -> (
55
+ AsyncGenerator[Tuple[SmokeTestDetails, PortClient], None]
56
+ ):
57
+ blueprint_department = "fake-department"
58
+ blueprint_person = "fake-person"
59
+ integration_identifier = "smoke-test-integration"
60
+ smoke_test_suffix = environ.get("SMOKE_TEST_SUFFIX")
61
+ client_id = environ.get("PORT_CLIENT_ID")
62
+ client_secret = environ.get("PORT_CLIENT_SECRET")
63
+
64
+ if not client_secret or not client_id:
65
+ assert False, "Missing port credentials"
66
+
67
+ base_url = environ.get("PORT_BASE_URL")
68
+ integration_version = "0.1.1-dev"
69
+ integration_type = "smoke-test"
70
+ if smoke_test_suffix is not None:
71
+ integration_identifier = f"{integration_identifier}-{smoke_test_suffix}"
72
+ blueprint_person = f"{blueprint_person}-{smoke_test_suffix}"
73
+ blueprint_department = f"{blueprint_department}-{smoke_test_suffix}"
74
+
75
+ client = get_port_client_for_integration(
76
+ client_id,
77
+ client_secret,
78
+ integration_identifier,
79
+ integration_type,
80
+ integration_version,
81
+ base_url,
82
+ )
83
+
84
+ smoke_test_details = SmokeTestDetails(
85
+ integration_identifier=integration_identifier,
86
+ blueprint_person=blueprint_person,
87
+ blueprint_department=blueprint_department,
88
+ )
89
+ yield smoke_test_details, client
90
+ await cleanup_integration(client, [blueprint_department, blueprint_person])
91
+
92
+
93
+ @pytest_asyncio.fixture
94
+ def get_mocked_ocean_app(request: Any) -> Callable[[], Ocean]:
95
+ test_dir = path.join(path.dirname(request.module.__file__), "..")
96
+
97
+ def get_ocean_app() -> Ocean:
98
+ return get_integration_ocean_app(test_dir)
99
+
100
+ return get_ocean_app
101
+
102
+
103
+ @pytest_asyncio.fixture
104
+ def get_mock_ocean_resource_configs(request: Any) -> Callable[[], List[ResourceConfig]]:
105
+ module_dir = path.join(path.dirname(request.module.__file__), "..")
106
+
107
+ def get_ocean_resource_configs() -> List[ResourceConfig]:
108
+ return get_integation_resource_configs(module_dir)
109
+
110
+ return get_ocean_resource_configs
@@ -1,7 +1,7 @@
1
1
  import sys
2
2
  from inspect import getmembers
3
3
  from pathlib import Path
4
- from typing import Dict, List, Set, Tuple, Union
4
+ from typing import List, Tuple
5
5
 
6
6
  from yaml import safe_load
7
7
 
@@ -46,35 +46,9 @@ def get_integation_resource_configs(integration_path: str) -> List[ResourceConfi
46
46
  return [ResourceConfig(**item) for item in resource_configs["resources"]]
47
47
 
48
48
 
49
- def get_integation_resource_config_by_name(
50
- integration_path: str, kind: str
51
- ) -> Union[ResourceConfig, None]:
52
- resource_configs = get_integation_resource_configs(integration_path)
49
+ async def get_raw_result_on_integration_sync_resource_config(
50
+ app: Ocean, resource_config: ResourceConfig
51
+ ) -> Tuple[RESYNC_RESULT, List[Exception]]:
52
+ resource_result = await app.integration._get_resource_raw_results(resource_config)
53
53
 
54
- relevant_configs = [x for x in resource_configs if x.kind == kind]
55
-
56
- return relevant_configs[0] if len(relevant_configs) else None
57
-
58
-
59
- async def get_raw_result_on_integration_sync_kinds(
60
- integration_path: str, override_kinds: Union[Set[str], None] = None
61
- ) -> Dict[str, List[Tuple[RESYNC_RESULT, List[Exception]]]]:
62
- app = get_integration_ocean_app(integration_path)
63
-
64
- resource_configs = get_integation_resource_configs(integration_path)
65
-
66
- if override_kinds:
67
- resource_configs = [x for x in resource_configs if x.kind in override_kinds]
68
-
69
- results: Dict[str, List[Tuple[RESYNC_RESULT, List[Exception]]]] = {}
70
-
71
- for resource_config in resource_configs:
72
- resource_result = await app.integration._get_resource_raw_results(
73
- resource_config
74
- )
75
-
76
- results[resource_config.kind] = results.get(resource_config.kind, []) + [
77
- resource_result
78
- ]
79
-
80
- return results
54
+ return resource_result
@@ -0,0 +1,71 @@
1
+ from os import environ
2
+ from typing import Tuple
3
+ import pytest
4
+
5
+ from port_ocean.clients.port.client import PortClient
6
+ from port_ocean.clients.port.types import UserAgentType
7
+ from port_ocean.tests.helpers.fixtures import SmokeTestDetails
8
+
9
+
10
+ @pytest.mark.skipif(
11
+ environ.get("SMOKE_TEST_SUFFIX", None) is None,
12
+ reason="You need to run the fake integration once",
13
+ )
14
+ async def test_valid_fake_integration(
15
+ port_client_for_fake_integration: Tuple[SmokeTestDetails, PortClient],
16
+ ) -> None:
17
+ _, port_client = port_client_for_fake_integration
18
+ current_integration = await port_client.get_current_integration()
19
+ assert current_integration is not None
20
+ assert current_integration.get("resyncState") is not None
21
+ assert current_integration.get("resyncState", {}).get("status") == "completed"
22
+
23
+
24
+ @pytest.mark.skipif(
25
+ environ.get("SMOKE_TEST_SUFFIX", None) is None,
26
+ reason="You need to run the fake integration once",
27
+ )
28
+ async def test_valid_fake_departments(
29
+ port_client_for_fake_integration: Tuple[SmokeTestDetails, PortClient],
30
+ ) -> None:
31
+ details, port_client = port_client_for_fake_integration
32
+ entities = await port_client.search_entities(user_agent_type=UserAgentType.exporter)
33
+ assert len(entities)
34
+ departments = [
35
+ x for x in entities if f"{x.blueprint}" == details.blueprint_department
36
+ ]
37
+ assert len(departments) == 5
38
+
39
+
40
+ @pytest.mark.skipif(
41
+ environ.get("SMOKE_TEST_SUFFIX", None) is None,
42
+ reason="You need to run the fake integration once",
43
+ )
44
+ async def test_valid_fake_persons(
45
+ port_client_for_fake_integration: Tuple[SmokeTestDetails, PortClient],
46
+ ) -> None:
47
+ details, port_client = port_client_for_fake_integration
48
+ headers = await port_client.auth.headers()
49
+ fake_person_entities_result = await port_client.client.get(
50
+ f"{port_client.auth.api_url}/blueprints/{details.blueprint_person}/entities",
51
+ headers=headers,
52
+ )
53
+
54
+ fake_person_entities = fake_person_entities_result.json()["entities"]
55
+ assert len(fake_person_entities)
56
+
57
+ fake_departments_result = await port_client.client.get(
58
+ f"{port_client.auth.api_url}/blueprints/{details.blueprint_department}/entities",
59
+ headers=headers,
60
+ )
61
+
62
+ departments = [x["identifier"] for x in fake_departments_result.json()["entities"]]
63
+
64
+ for department in departments:
65
+ assert len(
66
+ [
67
+ x
68
+ for x in fake_person_entities
69
+ if x["relations"]["department"] == department
70
+ ]
71
+ )
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "port-ocean"
3
- version = "0.10.10"
3
+ version = "0.10.12"
4
4
  description = "Port Ocean is a CLI tool for managing your Port projects."
5
5
  readme = "README.md"
6
6
  homepage = "https://app.getport.io"
File without changes
File without changes