Skip to content

Commit

Permalink
Add optional config overrides in mock ocean app fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzaadi committed Oct 13, 2024
1 parent 2db8bb5 commit e692b0e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions port_ocean/tests/helpers/fixtures.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from os import path
from typing import Any, Callable, List, Tuple
from typing import Any, Callable, Dict, List, Tuple, Union

import pytest
import pytest_asyncio
Expand Down Expand Up @@ -30,8 +30,8 @@ def port_client_for_fake_integration() -> Tuple[SmokeTestDetails, PortClient]:
def get_mocked_ocean_app(request: Any) -> Callable[[], Ocean]:
test_dir = path.join(path.dirname(request.module.__file__), "..")

def get_ocean_app() -> Ocean:
return get_integration_ocean_app(test_dir)
def get_ocean_app(config_overrides: Union[Dict[str, Any], None] = None) -> Ocean:
return get_integration_ocean_app(test_dir, config_overrides)

return get_ocean_app

Expand Down
15 changes: 10 additions & 5 deletions port_ocean/tests/helpers/ocean_app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
from inspect import getmembers
from pathlib import Path
from typing import List, Tuple
from typing import Any, Dict, List, Tuple, Union

from yaml import safe_load

Expand All @@ -12,7 +12,9 @@
from port_ocean.utils.misc import get_spec_file, load_module


def get_integration_ocean_app(integration_path: str) -> Ocean:
def get_integration_ocean_app(
integration_path: str, config_overrides: Union[Dict[str, Any], None] = None
) -> Ocean:
spec_file = get_spec_file(Path(integration_path))

config_factory = None if not spec_file else spec_file.get("configurations", [])
Expand All @@ -21,9 +23,12 @@ def get_integration_ocean_app(integration_path: str) -> Ocean:
integration_path,
config_factory,
{
"port": {
"client_id": "bla",
"client_secret": "bla",
**(config_overrides or {}),
**{
"port": {
"client_id": "bla",
"client_secret": "bla",
},
},
},
)
Expand Down

0 comments on commit e692b0e

Please sign in to comment.