Commit fc5e1a8
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
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
This file was deleted.
This file was deleted.
0 commit comments