Skip to content

Commit 99129aa

Browse files
fix(front): upgrade to SDK 2.0.0, add unit tests (#288)
* fix(front): upgrade to SDK 2.0.0, add unit tests - Upgrade autohive-integrations-sdk to ~=2.0.0 - Access FetchResponse.data on all context.fetch() call sites - Replace error dict returns with ActionError(message=...) - Replace success dict returns with ActionResult(data=...) - Remove legacy result/error fields from all output schemas in config.json - Bump integration version to 2.0.0 - Add pytest unit tests (77 tests) following the writing-unit-tests skill - Add front/tests/conftest.py * fix(front): remove aiohttp from requirements — provided by SDK * refactor(front): split unit tests into domain files per writing-unit-tests skill * fix(front): add integration test, update .env.example, apply ruff format - Add test_front_integration.py with FRONT_API_TOKEN env var skip guard - Add FRONT_API_TOKEN to .env.example - Apply ruff format to all front test files and front.py * test(front): modernize test harness * fix(front): return attachment upload failures as action errors * test(front): align live test token naming * fix(front): correct integration test import from front.front * test(front): expand integration tests to all 17 actions; fix nullable recipient.name in config schema --------- Co-authored-by: Shubhank <72601061+Sagsgit@users.noreply.github.com> Co-authored-by: Kai Koenig <kai@ventego-creative.co.nz>
1 parent d7df4c6 commit 99129aa

13 files changed

Lines changed: 3967 additions & 2551 deletions

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@
8484
# HARVEST_ACCESS_TOKEN=
8585
# HARVEST_ACCOUNT_ID=
8686

87+
# -- Front --
88+
# FRONT_ACCESS_TOKEN=
89+
8790
# -- Gong --
8891
# GONG_ACCESS_KEY=
8992
# GONG_ACCESS_KEY_SECRET=

front/config.json

Lines changed: 2046 additions & 1870 deletions
Large diffs are not rendered by default.

front/front.py

Lines changed: 240 additions & 272 deletions
Large diffs are not rendered by default.

front/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
autohive-integrations-sdk~=1.0.2
1+
autohive-integrations-sdk~=2.0.0

front/tests/conftest.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import os
2+
import sys
3+
from unittest.mock import AsyncMock, MagicMock
4+
5+
import pytest
6+
7+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
8+
9+
10+
@pytest.fixture
11+
def mock_context():
12+
"""Mock execution context with the platform OAuth shape Front expects."""
13+
ctx = MagicMock(name="ExecutionContext")
14+
ctx.fetch = AsyncMock(name="fetch")
15+
ctx.auth = {
16+
"auth_type": "PlatformOauth2",
17+
"credentials": {"access_token": "test_token"}, # nosec B105
18+
}
19+
return ctx

front/tests/context.py

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)