feat(float): upgrade SDK to 2.0.0, add pytest unit tests#284
feat(float): upgrade SDK to 2.0.0, add pytest unit tests#284Shubhank-Jonnada merged 12 commits intomasterfrom
Conversation
- Bump autohive-integrations-sdk pin from ==1.0.2 to ~=2.0.0 - Update all context.fetch() call sites to access .data on FetchResponse - Fix connected account handler to use response.data for isinstance check - Bump config.json version to 2.0.0 - Create float/tests/conftest.py with standard sys.path insert - Create float/tests/test_float_unit.py with 71 unit tests covering people, projects, tasks, time off, logged time, clients, departments, roles, reference data, holidays, phases, milestones, reports, and auth header verification
🔍 Integration Validation ResultsCommit: Changed directories:
✅ Structure Check output✅ Code Check output✅ Tests Check output✅ README Check output✅ Version Check output |
…pe assertions - Add ActionError import and convert all raise Exception() error paths to return ActionError(message=...) - Fix action handlers to use response.data from FetchResponse - Fix connected account handler to use response.data - Replace integration-style test_float.py with proper unit tests split by domain - 106 unit tests across 5 files: people, projects, tasks, timeoff, misc - All tests use FetchResponse mocks and ResultType.ACTION_ERROR assertions per skill
…tead of pytest.raises
TheRealAgentK
left a comment
There was a problem hiding this comment.
SDK 2.0.0 migration looks clean and 71 new unit tests run alongside the existing suite (177 total). Local CI verified: validate_integration ✅, check_code ✅, ruff ✅, pytest ✅.
Blocking on one thing: no tests/test_float_integration.py. float uses a custom API-key auth, so adding e2e coverage is low-cost — one env var (FLOAT_API_KEY) and the live_context fixture per the writing-integration-tests skill. Please add at minimum read-only smoke coverage for the major resource families (people, projects, tasks, allocations) before merge. Mark any create/update/delete tests with @pytest.mark.destructive.
Also: branch name doesn't follow <type>/<issue#>/<desc> per AGENTS.md, and no linked issue.
…ion tests passing
TheRealAgentK
left a comment
There was a problem hiding this comment.
🔴 Must fix — os.chdir(_parent) is process-global
Three places at module level:
- float/tests/conftest.py:6
- float/tests/test_float_unit.py:14
- float/tests/test_float_integration.py:19
os.chdir() changes the cwd for the whole pytest process. pytest . collects these files and the cwd leaks into every other integration's tests, breaking anything that uses relative paths. The other 4 unit-test files in this PR don't do it. The importlib.spec_from_file_location block uses an absolute path, so the chdir isn't needed — remove all three.
🟡 Files to clean up
- float/tests/conftest.py — slim it down. The
importlib.spec_from_file_locationblock is redundant: every test file independently loadsfloat_modagain. Renaming the conftest out and re-running the suite produces the same 119/119 pass result. Drop the importlib block (and the chdir that comes with it). The validator requires either conftest.py or context.py, so the file should stay — minimum content satisfies the rule. - float/tests/test_float.py — pre-upgrade
asyncio.runtestbed. Not just unused: actually broken.from context import floatraisesImportError: cannot import name 'float' from 'context'becausecontext.pydoesn't re-export anything. Same shape astest_supadata_transcribe.pydeleted in #280. - float/tests/context.py — only referenced by the broken
test_float.py. Goes with it.
…tions - Make all output schema field types nullable to match Float API reality (API returns null for many optional fields that were typed as non-nullable) - Change `active` field type from boolean to [integer, boolean, null] since Float API returns 1/0 integers, not booleans - Fix list_statuses to return [] instead of None on 204 No Content response - Fix integration test assertions: - List endpoints: assert isinstance(data, list) not wrapped key access - Get endpoints: assert isinstance(data, dict) not wrapped key access - Use task_meta_id fallback for project_task items (API uses different key) - Use id fallback for public_holiday and project_stage items - Destructive tests: access fields directly on dict not via nested wrapper
|
@TheRealAgentK — addressed all reviewer feedback and ran full live tests against the Float API. Changes made:
Live test results: 34 passed, 9 skipped (skips are empty-account data gaps, not failures) Full results |
Summary
context.auth.get("credentials", {}).get("api_key", "")inputs.get(), required params useinputs["param"]response.data/response.statusfromFetchResponseActionError(message=str(e))on errorsTest Results
Unit Tests (mocked, CI-safe) — 13 passed ✅
Integration Tests (live Float API — 2026-05-04) — 34 passed, 9 skipped ✅
Skipped tests are due to empty test account (no existing clients, roles, statuses, etc.) — not integration failures.
Validation