🧪 Add test for bad JSON token in fetch_sourcing_bom.py - #4
Conversation
Added a Pytest fixture for testing the exception block when a malformed DigiKey token JSON file is encountered during the get_digikey_access_token function execution. Co-authored-by: aman-katyal <181611364+aman-katyal@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
🎯 What: Added a missing error test for
get_digikey_access_tokeninfetch_sourcing_bom.py. The original implementation had a try/except block forjson.load()without any unit tests asserting its behavior.📊 Coverage: The new
test_get_digikey_access_token_bad_jsontest covers the scenario where the DigiKey token file (DIGIKEY_TOKEN_PATH) exists but contains invalid JSON data, ensuring that the script correctly catches theException, prints a warning tosys.stderr, and continues gracefully.✨ Result: Improved test coverage by explicitly validating the error handling logic, ensuring the script gracefully handles corrupt token files instead of crashing.
PR created automatically by Jules for task 14391349534075253118 started by @aman-katyal