Skip to content

Commit fc5e1a8

Browse files
feat(app-business-reviews): upgrade SDK to 2.0.0, add pytest unit tests (#285)
* feat(app-business-reviews): upgrade SDK to 2.0.0, add pytest unit tests - Pin autohive-integrations-sdk~=2.0.0 in requirements.txt - Add .data to all context.fetch() return accesses - Convert raise ValueError to return ActionError(message=...) - Return ActionResult(data=..., cost_usd=0.0) from all action handlers - Bump config.json version to 2.0.0 - Add tests/conftest.py and 40-test unit suite covering all 6 actions * fix(app-business-reviews): fix auth, optional params, add proper unit and integration tests - Fix api_key default from {} to "" in all action handlers - Delete old manual asyncio test file - Add test_app_business_reviews_integration.py with pytest.mark.integration, APP_BUSINESS_REVIEWS_API_KEY env var - Add APP_BUSINESS_REVIEWS_API_KEY to .env.example * fix(app-business-reviews): fix integration tests per skill guidelines * fix(app-business-reviews): fix ruff formatting issues * fix(app-business-reviews): fix ruff formatting * fix(app-business-reviews): reformat with line-length 120 to match tooling ruff config * fix(app-business-reviews): correct mock_context.auth shape in unit tests The source code reads context.auth.get("credentials", {}).get("api_key", ""), but the test fixture set ctx.auth = {"api_key": "..."}. As a result every action received api_key="" in unit tests. The mismatch was silent because no test asserted on params["api_key"]. Adds a regression assertion in TestSearchAppsIOS::test_request_params_include_term that verifies api_key is forwarded from the credentials block, so any future auth-shape drift will fail the suite immediately. * fix(app-business-reviews): point tests/conftest.py at integration root The previous conftest inserted the tests directory itself onto sys.path, which is a no-op for the intended purpose of making the integration's modules importable from test files. Insert the parent (integration root) instead, matching the pattern from PRs #280, #289, #306, and #307. * refactor(app-business-reviews): drop importlib boilerplate from tests With tests/conftest.py putting the integration root on sys.path and the workspace conftest.py patching Integration.load to find config.json, test files can now import the integration with a plain 'from app_business_reviews import app_business_reviews'. Removes the importlib.util.spec_from_file_location dance from both test files and the now-unused dependencies/ sys.path entry. Also deletes the legacy tests/context.py shim from the pre-SDK-2.0 testbed. Matches the simpler pattern used in PRs #280, #289, #306, #307. * refactor(app-business-reviews): remove response = None / 'is not None' guards Both get_reviews_google_play and get_reviews_google_maps tracked the last response object across the pagination loop just so the post-loop code could call response.data.get(...) for product/place info, with a defensive 'if response is not None' guard for the max_pages=0 case. Capture app_info / place_info inside the loop instead, initialized to an empty dict before the loop. Same behavior, no defensive guard, no loop-leaked variable. * refactor(app-business-reviews): restore post-loop app/place_info extraction Reverts the in-loop assignment introduced in c1455c7. The original code extracted product_info / place_info from the response variable once after the pagination loop, which is the more idiomatic shape (one read, one write). Keeps the sentinel-and-guard pattern that c1455c7 was meant to clean up, but adds a comment explaining why the guard is there (max_pages=0 edge case where the loop never executes). --------- Co-authored-by: Shubhank <72601061+Sagsgit@users.noreply.github.com> Co-authored-by: Kai Koenig <kai@ventego-creative.co.nz>
1 parent cb80d0a commit fc5e1a8

9 files changed

Lines changed: 1090 additions & 404 deletions

.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,10 @@
7070
# SUPADATA_API_KEY=
7171
# -- LinkedIn --
7272
# LINKEDIN_ACCESS_TOKEN=
73+
74+
# -- App Business Reviews --
75+
# APP_BUSINESS_REVIEWS_API_KEY=
76+
77+
# -- Gong --
78+
# GONG_ACCESS_KEY=
79+
# GONG_ACCESS_KEY_SECRET=

app-business-reviews/app_business_reviews.py

Lines changed: 120 additions & 64 deletions
Large diffs are not rendered by default.

app-business-reviews/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "App and Business Reviews",
33
"display_name": "App and Business Reviews",
4-
"version": "1.0.0",
4+
"version": "2.0.0",
55
"description": "Access reviews from App Store, Google Play Store, and Google Maps using SerpAPI",
66
"entry_point": "app_business_reviews.py",
77
"auth": {
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
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import os
2+
import sys
3+
4+
# Put the integration root on sys.path so test files can use plain imports
5+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))

app-business-reviews/tests/context.py

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

app-business-reviews/tests/test_app_business_reviews.py

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

0 commit comments

Comments
 (0)