Skip to content

test: add unit tests for ai_provider with mocked LLM responses#258

Open
yachikadev wants to merge 4 commits into
imDarshanGK:mainfrom
yachikadev:feat/unit-tests-ai-provider
Open

test: add unit tests for ai_provider with mocked LLM responses#258
yachikadev wants to merge 4 commits into
imDarshanGK:mainfrom
yachikadev:feat/unit-tests-ai-provider

Conversation

@yachikadev
Copy link
Copy Markdown

Description

Added comprehensive unit tests for backend/app/services/ai_provider.py as per issue #212.

  • Mocked responses for OpenAI, Groq, and Ollama providers
  • Covered success cases, response parsing, fallback behavior, timeout, HTTP errors, and malformed responses
  • All tests are fully offline using unittest.mock

Related Issue

Fixes #212

Type of change

  • Test addition

Checklist

  • I have read CONTRIBUTING.md
  • My branch is up to date with main
  • I have run pytest -v and all tests pass
  • I have not introduced duplicate issues or features
  • My PR title follows the format: feat/fix/docs/test: short description
  • I have added tests for new features
  • No hardcoded secrets or API keys in my code
  • This PR is linked to a GSSoC 2026 issue

Screenshots (if frontend change)

N/A (Backend only)

Test evidence

cd backend
pytest tests/test_ai_provider.py -v
All tests passed successfully.

@yachikadev yachikadev requested a review from imDarshanGK as a code owner May 22, 2026 15:56
@yachikadev
Copy link
Copy Markdown
Author

Hi @imDarshanGK,

I have added comprehensive unit tests for ai_provider.py as per issue #212.

All tests are passing locally. Please review when possible.

Thank you!

@yachikadev
Copy link
Copy Markdown
Author

Hi @imDarshanGK,

I have been waiting for more than 30 minutes but the Lint workflow is still showing as pending.

Could you please approve or re-run the workflow?

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unit tests for ai_provider with mocked LLM responses

1 participant