Commit d7df4c6
feat(harvest): upgrade SDK to 2.0.0, add pytest unit tests (#276)
* feat(harvest): upgrade SDK to 2.0.0, add pytest unit tests
- Bump autohive-integrations-sdk pin to ~=2.0.0
- Update all context.fetch() return values to access .data
- Convert all error returns from bare dicts to ActionError(message=...)
- Convert all success returns to ActionResult(data={...}, cost_usd=0.0)
- Import ActionResult, ActionError from SDK
- Remove 'error' and 'success' fields from output schemas in config.json
- Bump config.json version to 2.0.0
- Add harvest/tests/conftest.py, __init__.py, test_harvest_unit.py
- 42 unit tests covering all 10 actions (happy path, request verification, error paths, edge cases)
* fix(harvest): fix optional params to use .get(), add pytest tests, integration tests
- Replace all optional inputs["param"] bracket access with inputs.get("param")
to prevent KeyError when optional params are not provided (fixes 43 warnings)
- Add harvest/tests/test_harvest_integration.py with real HTTP tests for
list_time_entries, list_projects, list_clients, list_tasks, list_users
- Delete old manual-run test_harvest.py (replaced by unit + integration tests)
- Update conftest.py to insert parent dir into sys.path
- Add HARVEST_ACCESS_TOKEN and HARVEST_ACCOUNT_ID to .env.example
* test(harvest): modernize live test fixtures
* test(harvest): document live test token setup
* fix(harvest): allow null pagination fields in output schema; expand integration tests to all 10 actions
* test(harvest): rewrite destructive fixture to use live_context.fetch
temp_project_and_task now creates client/project/task/assignment
through the authenticated live_context.fetch rather than a raw
aiohttp session, which was returning 401 due to missing auth headers.
* test(harvest): fix live test assertions and token/account setup
* style(harvest): fix E501 lint errors and ruff formatting in integration tests
* style(harvest): reformat with line-length=120 per tooling ruff config
---------
Co-authored-by: Shubhank <72601061+Sagsgit@users.noreply.github.com>
Co-authored-by: Kai Koenig <kai@ventego-creative.co.nz>1 parent c8020c2 commit d7df4c6
9 files changed
Lines changed: 1010 additions & 603 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
83 | 87 | | |
84 | 88 | | |
85 | 89 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
68 | | - | |
| 66 | + | |
69 | 67 | | |
70 | 68 | | |
71 | 69 | | |
| |||
85 | 83 | | |
86 | 84 | | |
87 | 85 | | |
88 | | - | |
89 | | - | |
90 | | - | |
| 86 | + | |
91 | 87 | | |
92 | 88 | | |
93 | 89 | | |
| |||
150 | 146 | | |
151 | 147 | | |
152 | 148 | | |
153 | | - | |
154 | 149 | | |
155 | | - | |
156 | | - | |
157 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
158 | 153 | | |
159 | 154 | | |
160 | | - | |
161 | | - | |
162 | | - | |
| 155 | + | |
| 156 | + | |
163 | 157 | | |
164 | 158 | | |
165 | 159 | | |
| |||
212 | 206 | | |
213 | 207 | | |
214 | 208 | | |
215 | | - | |
216 | | - | |
217 | | - | |
| 209 | + | |
218 | 210 | | |
219 | 211 | | |
220 | 212 | | |
| |||
234 | 226 | | |
235 | 227 | | |
236 | 228 | | |
237 | | - | |
238 | | - | |
239 | | - | |
| 229 | + | |
240 | 230 | | |
241 | 231 | | |
242 | 232 | | |
| |||
273 | 263 | | |
274 | 264 | | |
275 | 265 | | |
276 | | - | |
277 | 266 | | |
278 | | - | |
279 | | - | |
280 | | - | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
281 | 270 | | |
282 | 271 | | |
283 | | - | |
284 | | - | |
285 | | - | |
| 272 | + | |
| 273 | + | |
286 | 274 | | |
287 | 275 | | |
288 | 276 | | |
| |||
302 | 290 | | |
303 | 291 | | |
304 | 292 | | |
305 | | - | |
306 | | - | |
307 | | - | |
| 293 | + | |
308 | 294 | | |
309 | 295 | | |
310 | 296 | | |
| |||
337 | 323 | | |
338 | 324 | | |
339 | 325 | | |
340 | | - | |
341 | 326 | | |
342 | | - | |
343 | | - | |
344 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
345 | 330 | | |
346 | 331 | | |
347 | | - | |
348 | | - | |
349 | | - | |
| 332 | + | |
| 333 | + | |
350 | 334 | | |
351 | 335 | | |
352 | 336 | | |
| |||
379 | 363 | | |
380 | 364 | | |
381 | 365 | | |
382 | | - | |
383 | 366 | | |
384 | | - | |
385 | | - | |
386 | | - | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
387 | 370 | | |
388 | 371 | | |
389 | | - | |
390 | | - | |
391 | | - | |
| 372 | + | |
| 373 | + | |
392 | 374 | | |
393 | 375 | | |
394 | 376 | | |
| |||
421 | 403 | | |
422 | 404 | | |
423 | 405 | | |
424 | | - | |
425 | 406 | | |
426 | | - | |
427 | | - | |
428 | | - | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
429 | 410 | | |
430 | 411 | | |
431 | | - | |
432 | | - | |
433 | | - | |
| 412 | + | |
| 413 | + | |
434 | 414 | | |
435 | 415 | | |
436 | 416 | | |
437 | 417 | | |
438 | 418 | | |
| 419 | + | |
0 commit comments