test: Adding missing tests or correcting existing tests#7
test: Adding missing tests or correcting existing tests#7Pavan-Microsoft wants to merge 17 commits intodevfrom
Conversation
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Prajwal-Microsoft <v-dcprajwal@microsoft.com> Co-authored-by: Roopan-Microsoft <168007406+Roopan-Microsoft@users.noreply.github.com> Co-authored-by: Ajit Padhi <v-padhiajit@microsoft.com> Co-authored-by: Roopan P M <v-roopanpm@microsoft.com> Co-authored-by: Pavan-Microsoft <v-kupavan@microsoft.com> Co-authored-by: Ross Smith <ross-p-smith@users.noreply.github.com> Co-authored-by: gpickett <122489228+gpickett@users.noreply.github.com> Co-authored-by: Francia Riesco <friesco@microsoft.com> Co-authored-by: Francia Riesco <Fr4nc3@users.noreply.github.com> Co-authored-by: Harmanpreet-Microsoft <v-harmanprka@microsoft.com> Co-authored-by: UtkarshMishra-Microsoft <v-utkamishra@microsoft.com> Co-authored-by: Prasanjeet-Microsoft <v-singhprasa@microsoft.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kiran-Siluveru-Microsoft <v-ksiluveru@microsoft.com> Co-authored-by: Prashant-Microsoft <v-pmalusare@microsoft.com> Co-authored-by: Rohini-Microsoft <v-rwalunj@microsoft.com> Co-authored-by: Avijit-Microsoft <v-aghorui@microsoft.com> Co-authored-by: RaviKiran-Microsoft <v-ravikirans@microsoft.com> Co-authored-by: Somesh Joshi <v-somejoshi@microsoft.com> Co-authored-by: Himanshi Agrawal <v-himagrawal@microsoft.com> Co-authored-by: pradeepjha-microsoft <v-pradeepjha@microsoft.com> Co-authored-by: Harmanpreet Kaur <v-harmanpkau@microsoft.com> Co-authored-by: Bangarraju-Microsoft <v-golib@microsoft.com> Co-authored-by: Harsh-Microsoft <v-hbangera@microsoft.com> Co-authored-by: Kanchan-Microsoft <v-knagshetti@microsoft.com> Co-authored-by: Cristopher Coronado <cristofima@hotmail.com> Co-authored-by: Cristopher Coronado Moreira <crcorona@pichincha.com> Co-authored-by: Vamshi-Microsoft <v-vamolla@microsoft.com> Co-authored-by: Thanusree-Microsoft <168087422+Thanusree-Microsoft@users.noreply.github.com> Co-authored-by: Niraj Chaudhari (Persistent Systems Inc) <v-nirajcha@microsoft.com> Co-authored-by: Rohini-Microsoft <168007985+Rohini-Microsoft@users.noreply.github.com> Co-authored-by: Kingshuk-Microsoft <v-kidatta@microsoft.com> Co-authored-by: Ayaz-Microsoft <v-ayazkhan@microsoft.com> Co-authored-by: Abdul-Microsoft <v-amujeebta@microsoft.com> Co-authored-by: Prekshith-Microsoft <v-pdj@microsoft.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: NirajC-Microsoft <v-nirajcha@microsoft.com> Co-authored-by: Roopan-Microsoft <168007406+Roopan-Microsoft@users.noreply.github.com> Co-authored-by: Ajit Padhi <v-padhiajit@microsoft.com> Co-authored-by: Roopan P M <v-roopanpm@microsoft.com> Co-authored-by: Pavan-Microsoft <v-kupavan@microsoft.com> Co-authored-by: Ross Smith <ross-p-smith@users.noreply.github.com> Co-authored-by: gpickett <122489228+gpickett@users.noreply.github.com> Co-authored-by: Francia Riesco <friesco@microsoft.com> Co-authored-by: Francia Riesco <Fr4nc3@users.noreply.github.com> Co-authored-by: Harmanpreet-Microsoft <v-harmanprka@microsoft.com> Co-authored-by: UtkarshMishra-Microsoft <v-utkamishra@microsoft.com> Co-authored-by: Priyanka-Microsoft <v-prisinghal@microsoft.com> Co-authored-by: Prasanjeet-Microsoft <v-singhprasa@microsoft.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kiran-Siluveru-Microsoft <v-ksiluveru@microsoft.com> Co-authored-by: Prashant-Microsoft <v-pmalusare@microsoft.com> Co-authored-by: Rohini-Microsoft <v-rwalunj@microsoft.com> Co-authored-by: Avijit-Microsoft <v-aghorui@microsoft.com> Co-authored-by: RaviKiran-Microsoft <v-ravikirans@microsoft.com> Co-authored-by: Somesh Joshi <v-somejoshi@microsoft.com> Co-authored-by: Himanshi Agrawal <v-himagrawal@microsoft.com> Co-authored-by: pradeepjha-microsoft <v-pradeepjha@microsoft.com> Co-authored-by: Harmanpreet Kaur <v-harmanpkau@microsoft.com> Co-authored-by: Bangarraju-Microsoft <v-golib@microsoft.com> Co-authored-by: Harsh-Microsoft <v-hbangera@microsoft.com> Co-authored-by: Kanchan-Microsoft <v-knagshetti@microsoft.com> Co-authored-by: Cristopher Coronado <cristofima@hotmail.com> Co-authored-by: Cristopher Coronado Moreira <crcorona@pichincha.com> Co-authored-by: Vamshi-Microsoft <v-vamolla@microsoft.com> Co-authored-by: Thanusree-Microsoft <168087422+Thanusree-Microsoft@users.noreply.github.com> Co-authored-by: Rohini-Microsoft <168007985+Rohini-Microsoft@users.noreply.github.com> Co-authored-by: Kingshuk-Microsoft <v-kidatta@microsoft.com> Co-authored-by: Ayaz-Microsoft <v-ayazkhan@microsoft.com> Co-authored-by: Abdul-Microsoft <v-amujeebta@microsoft.com> Co-authored-by: Prekshith-Microsoft <v-pdj@microsoft.com> Co-authored-by: Rafi-Microsoft <v-rafmd@microsoft.com>
- Updated test cases in `test_env_helper.py` to set environment variables as strings for boolean values. - Added multiple test cases in `test_lang_chain_agent.py` to validate content safety input and output handling, including blocking harmful content and ensuring proper memory management with chat history. - Enhanced `test_open_ai_functions.py` with tests for function calls and content safety validation, ensuring robust handling of various scenarios including unknown function calls and null answers. - Removed obsolete test file `test_azure_blob_storage_client.py`. - Expanded `test_content_safety_checker.py` to cover various scenarios for content safety checks, including handling harmful content, safe text validation, and error handling for HTTP responses.
There was a problem hiding this comment.
Pull request overview
This pull request adds comprehensive unit tests for several backend modules and utilities, improving test coverage and reliability. The changes include new test modules for authentication, document processing, chat history, and database operations, along with enhancements to existing test suites and an update to the pytest coverage configuration for better output visibility.
Changes:
- Added comprehensive tests for content safety, Azure Form Recognizer, blob storage, PostgreSQL, authentication utilities, and chat history operations
- Enhanced existing tests for orchestrators, environment helpers, and CosmosDB operations
- Updated pytest coverage configuration to use
--cov=codeand--cov-report=term-missingfor more precise reporting
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/tests.yml |
Updated pytest coverage arguments for better reporting |
test_content_safety_checker.py |
Added extensive tests for content safety validation with RBAC/key auth |
test_azure_blob_storage_client.py |
Replaced with comprehensive tests covering all blob operations |
test_open_ai_functions.py |
Enhanced with function call orchestration tests |
test_lang_chain_agent.py |
Added tests for agent orchestration scenarios |
test_env_helper.py |
Fixed environment variable type handling |
test_azure_postgres_helper.py |
Added tests for PostgreSQL operations |
test_azure_form_recognizer_helper.py |
New comprehensive tests for document analysis |
test_create_app.py |
Enhanced with citation and markdown URL utility tests |
test_combine_pages_chunknos.py |
New tests for Azure Function page combining |
test_chat_history.py |
Significantly expanded with comprehensive API endpoint tests |
test_admin.py |
New tests for admin module CSS loading |
test_database_client_base.py |
New tests for abstract base class contract |
test_cosmosdb.py |
Enhanced with detailed CosmosDB operation tests |
test_auth_utils.py |
New tests for authentication utility functions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Roopan P M <v-roopanpm@microsoft.com> Co-authored-by: Roopan-Microsoft <168007406+Roopan-Microsoft@users.noreply.github.com> Co-authored-by: Pavan-Microsoft <v-kupavan@microsoft.com> Co-authored-by: Prasanjeet-Microsoft <v-singhprasa@microsoft.com> Co-authored-by: Harmanpreet Kaur <v-harmanpkau@microsoft.com> Co-authored-by: Harmanpreet-Microsoft <v-harmanprka@microsoft.com>
Purpose
This pull request adds comprehensive unit tests for several backend modules and utilities, improving test coverage and reliability. It introduces new test modules for authentication utilities, page/chunk combining logic, and admin-related functionality, as well as significant enhancements to citation and markdown URL utilities testing. Additionally, it updates the Python test coverage configuration to provide more detailed output.
New and Enhanced Unit Tests:
test_auth_utils.pywith thorough tests forget_authenticated_user_detailsandget_tenantid, covering various header scenarios, error handling, and edge cases.test_combine_pages_chunknos.pyto test the Azure Function for combining pages and chunk numbers, including normal operation, error handling, and WebApiSkill response structure.test_admin.pyfor theload_cssfunction, testing file reading, error propagation, and Streamlit integration.test_create_app.py(renamed fromtest_app.py) to include tests forget_markdown_urlandget_citations, verifying URL formatting, SAS token handling, citation parsing, and metadata extraction. [1] [2]Test Configuration Improvements:
--cov=codeand--cov-report=term-missingfor more precise and visible coverage reporting.Does this introduce a breaking change?