fix(freshdesk): upgrade to SDK 2.0.0, add unit tests#287
Conversation
- Update SDK to 2.0.0: all context.fetch() calls access .data - Import and use ActionResult/ActionError return types - Fix auth: use flat context.auth dict (custom auth type) - Remove legacy result/error fields from all output schemas - Bump config.json version to 2.0.0 - Add 88 pytest unit tests covering all 17 actions
🔍 Integration Validation ResultsCommit: Changed directories:
✅ Structure Check output✅ Code Check output✅ Tests Check output✅ README Check output✅ Version Check output |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8d7e545f5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
TheRealAgentK
left a comment
There was a problem hiding this comment.
SDK 2.0.0 migration looks clean (good catch on the flat context.auth shape for custom auth) and the 88 unit tests provide solid coverage. Local CI verified: validate_integration ✅, check_code ✅, ruff ✅, pytest ✅.
Blocking on one thing: no tests/test_freshdesk_integration.py. Freshdesk uses a custom API-key auth, so adding e2e coverage is low-cost — env vars (FRESHDESK_DOMAIN, FRESHDESK_API_KEY) and the live_context fixture per the writing-integration-tests skill. Please add at minimum read-only smoke coverage for the major endpoints (tickets, contacts, agents) before merge. Mark create/update/delete tests with @pytest.mark.destructive.
Also: branch name doesn't follow <type>/<issue#>/<desc> per AGENTS.md, and no linked issue.
…n tests
- Replace all `inputs["param"]` with `inputs.get("param")` for optional
parameters to prevent KeyError if the parameter is not provided
- Add freshdesk/tests/test_freshdesk_integration.py with pytest.mark.integration
tests that skip when FRESHDESK_API_KEY or FRESHDESK_DOMAIN env vars are missing
TheRealAgentK
left a comment
There was a problem hiding this comment.
Self-approved to remove the block, needs 3rd party review and then e-2-e test runs.
…nullability - Fixed import in test file (module vs Integration instance) - Expanded integration tests from 7 to 8 covering all 20 actions - Added company lifecycle (create, get, update, delete) - Added contact lifecycle (create, get, update, delete) - Added ticket lifecycle (create, get, update, list_conversations, create_note, create_reply, delete) - Added search_companies and search_contacts read-only tests - Fixed config.json: note field type string -> ["string", "null"] to match Freshdesk API returning null
Live Integration TestsAll 20 actions tested live against the Freshdesk API across 8 test functions.
8 test functions, 20 actions, 20/20 passing live. Also caught and fixed a real bug during live testing: |
Summary
ActionResult/ActionErrorreturn typesFetchResponse.dataon allcontext.fetch()callsapi_key,domain)result/errorfields from output schemaspytest.mark.integrationlive suitefreshdesk/tests/context.pyFRESHDESK_API_KEYandFRESHDESK_DOMAINto.env.exampleAuth/test alignment
Freshdesk is configured with custom auth in
config.json:{ "type": "custom", "fields": { "api_key": "...", "domain": "..." } }The unit and live integration tests now match that flat custom-auth shape:
FRESHDESK_API_KEY,FRESHDESK_DOMAIN{"api_key": api_key, "domain": domain}api_key:X)Integration test coverage
Safe read-only live coverage includes:
list_companiesget_companywhen a company existslist_ticketsget_ticketwhen a ticket existslist_contactsget_contactwhen a contact existslist_conversationswhen a ticket existsSafe read-only command:
pytest freshdesk/tests/test_freshdesk_integration.py -m "integration and not destructive"Test plan
.venv/bin/python -m pytest freshdesk/tests -m unit -q— 88 passed.venv/bin/python -m pytest freshdesk/tests/test_freshdesk_integration.py -m "integration and not destructive" -q— 7 skipped without live Freshdesk creds.venv/bin/python -m pytest freshdesk/ -q— 88 passed; integration file not collected by default.venv/bin/python ../autohive-integrations-tooling/scripts/validate_integration.py freshdesk— passed.venv/bin/python ../autohive-integrations-tooling/scripts/check_code.py freshdesk— passed