test: Add comprehensive unit tests for UniversityPlugin and GeminiChatCompletionFactory#10
Open
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
Open
Conversation
…tCompletionFactory - Add isolated unit tests for UniversityPlugin with mocked HTTP requests - Add unit tests for GeminiChatCompletionFactory with mocked Gemini API - Create test fixtures with realistic university API response data - Create shared conftest.py with AppConfig fixtures - Mock all external dependencies (universities API and Google Gemini API) - Test success paths, error handling, edge cases, and input validation - All 39 new tests pass in <2 seconds without external API calls - Achieve comprehensive test coverage for both components - All tests run in isolation without external dependencies Co-Authored-By: tyler.barto@merck.com <tyler.barto+merck@merck.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
…o achieve 100% coverage - Add test_get_universities_by_country_generic_exception test - Achieves 100% coverage for UniversityPlugin (66/66 statements, up from 97%) - Both components now have 100% coverage: - UniversityPlugin: 100% (66/66 statements) - GeminiChatCompletionFactory: 100% (30/30 statements) - All 40 unit tests pass in <2 seconds Co-Authored-By: tyler.barto@merck.com <tyler.barto+merck@merck.com>
…ponse files - Split university_api_responses.json into two separate files: - university_search_responses.json: Mock data for search queries - university_api_responses.json: Mock data for country-specific API responses - Update conftest.py with two separate fixtures: - mock_university_search_data: For search query tests - mock_university_api_data: For country-specific tests - Update test_university_plugin.py to use correct fixtures for each test - Fix line length lint issue in test function definition This change aligns with the acceptance criteria requirement for separate mock data files for search responses and API responses. Co-Authored-By: tyler.barto@merck.com <tyler.barto+merck@merck.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds comprehensive isolated unit tests for the University Agent components created in Task 1. The tests cover the
UniversityPluginclass (university search functionality) and theGeminiChatCompletionFactoryclass (Gemini API chat completion factory) with complete mocking of external dependencies.Changes
tests/unit/directory with isolated unit testsuniversity_search_responses.json: Mock data for university search queriesuniversity_api_responses.json: Mock data for country-specific API responsesconftest.pywith pytest fixtures for AppConfig and mock data loadingunittest.mock.patchrequests.getGoogleAIChatCompletionType of Change
Critical Review Areas
test_university_plugin.pyline 7:/home/ubuntu/repos/teal-agents/src/orchestrators/...requests.getmocking completely prevents external HTTP callsGoogleAIChatCompletionmocking doesn't initialize real Gemini API clientssys.path.insert()manipulation may affect other testsconftest.pycould interfere with parallel test executionAdditional Review Checklist
Test Results
Link to Devin run: https://app.devin.ai/sessions/e10acc28c2e1442d829a2de87c843026
Requested by: @bartot_merck