litellm/tests/test_litellm/integrations
Ishaan Jaff 1a8525d02a
Add GDPR Art. 32 EU PII Protection Policy Template (#21340)
* Add 6 new EU PII patterns for GDPR compliance

- fr_nir: French Social Security Number (NIR/INSEE) with validation
- eu_iban_enhanced: Enhanced IBAN detection with specific format
- fr_phone: French phone numbers (+33, 0033, 0 formats)
- eu_vat: EU VAT identification numbers (all 27 member states)
- eu_passport_generic: Generic EU passport format
- fr_postal_code: French postal codes with contextual keywords

* Add GDPR Art. 32 EU PII Protection policy template

- Comprehensive GDPR Article 32 compliance policy
- 4 guardrail groups: National IDs, Financial, Contact Info, Business IDs
- Masks French NIR/INSEE, EU IBANs, French phones, EU VAT numbers
- Includes EU passport numbers and email addresses
- Medium complexity template with indigo icon

* Add comprehensive tests for EU PII patterns

- Test French NIR validation (sex digit, month range)
- Test enhanced IBAN detection (French, German)
- Test French phone number formats
- Test EU VAT numbers
- Test generic EU passport format
- Test French postal code pattern

* Add EU pattern loading and category validation tests

- Verify all 6 EU PII patterns are loaded correctly
- Verify patterns are categorized as 'EU PII Patterns'
- Ensure pattern loading consistency

* Add end-to-end tests for GDPR policy template

- 4 tests for PII that should be masked (NIR, IBAN, phone, VAT)
- 4 tests for text that should pass through (invalid patterns, no PII)
- 1 bonus test for multiple PII types in same message
- All tests verify correct masking behavior

* Add region field to policy templates

- Added region field to all 6 templates (EU, AU, Global)
- Updated both main and backup JSON files
- Enables region-based filtering in UI

* Add region filter to policy templates UI

- Added Radio.Group filter for regions (All, AU, EU, Global)
- Efficient filtering with useMemo hooks
- Clean button-based UI matching existing design
- Defaults missing regions to Global

* Apply suggestion from @greptile-apps[bot]

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* Address Greptile review: add contextual guards and negative tests

- Added keyword_pattern to eu_vat (VAT, tax number, fiscal code, etc.)
- Added keyword_pattern to eu_passport_generic (passport, travel document, etc.)
- Added 3 negative unit tests for false positive prevention
- Added 2 E2E tests verifying no masking without keyword context
- All patterns now require contextual keywords to prevent false positives

* address greptile review feedback (greploop iteration 1)

- Remove unused HTTPException import from test file
- Add keyword_pattern to eu_vat for contextual VAT matching
- Add allow_word_numbers: false to eu_passport_generic
- Add negative test cases for EU VAT false positives
- All 5 Greptile comments addressed

* Address Greptile feedback: fix patterns and sync backup

- Fix fr_phone pattern: use negative lookbehind (?<!\d) to prevent false matches in longer digit strings
- Add keyword_pattern to eu_passport_generic to reduce false positives on version strings/SKUs
- Sync policy_templates_backup.json with main file (add GDPR template)
- Add keyword_pattern to eu_vat (was auto-added by formatter)

All pattern tests passing

* address greptile review feedback (greploop iteration 2)

- Update test to document that eu_vat raw pattern is intentionally broad
- Test verifies pattern DOES match common words (by design)
- Documents that keyword_pattern guard prevents false positives in production
- Addresses Greptile's false positive risk concern

* address greptile review feedback (greploop iteration 3)

- Fix test_eu_vat_masked: change gap from 2 words to 1 word (VAT number: FR...)
- This ensures keyword matching works within MAX_KEYWORD_VALUE_GAP_WORDS=1 limit
- fr_phone pattern already works correctly (verified with tests)
- test_pattern_requires_keyword_context already updated in iteration 2

Addresses final issues from Greptile 2/5 review

* fix: remove country-specific passport patterns from GDPR template

- Remove passport_france, passport_germany, passport_netherlands from template
- These patterns lack keyword guards and cause false positives
- Only eu_passport_generic remains (has keyword_pattern guard)
- Sync policy_templates_backup.json with main file
- Update test setup to match template

All 11 E2E tests now passing 

* Update tests/test_litellm/proxy/guardrails/guardrail_hooks/content_filter/test_gdpr_policy_e2e.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* Update litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/content_filter.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-16 15:28:46 -08:00
..
arize add test for dynamic project name in metadata 2026-02-11 15:45:47 +05:30
azure_storage Fixing circular reference for azure storage 2026-01-14 16:11:55 -08:00
bitbucket (Feat) Add BitBucket Integration for Prompt Management (#14882) 2025-09-25 15:51:00 -07:00
cloudzero fix: test 2026-01-09 11:23:47 +09:00
datadog feat: add datadog cost management support and fix startup callback issue (#19584) 2026-01-22 19:52:14 -08:00
dotprompt test_dotprompt_with_prompt_version 2025-11-22 11:00:47 -08:00
focus fix: test 2026-01-09 11:23:47 +09:00
gcs_bucket update GCSBucketBase to handle GSM project ID if passed (#11409) 2025-06-04 10:02:26 -07:00
gcs_pubsub Litellm fix GitHub action testing (#11163) 2025-05-26 14:41:42 -07:00
gitlab TestEncryptResponseId 2026-01-07 21:03:22 +05:30
langfuse Revert "feat: Add built-in migration lock to prevent concurrent Prisma migrat…" (#18719) 2026-01-06 23:56:02 +05:30
levo TestLevoIntegration 2026-01-07 18:17:22 +05:30
open_telemetry/data add metrics and logs (events) with semconv attributes 2025-09-02 09:20:25 -06:00
SlackAlerting Litellm sameer oct staging (#15806) 2025-10-24 12:17:22 -07:00
websearch_interception Add tests for WebSearch interception with chat completions API 2026-02-09 13:41:29 +05:30
test_agentops.py Litellm fix GitHub action testing (#11163) 2025-05-26 14:41:42 -07:00
test_anthropic_cache_control_hook.py [Fix] Anthropic cache_control incorrectly applied to all content items instead of last item only (#15699) 2025-10-18 15:18:08 -07:00
test_athina.py Litellm fix GitHub action testing (#11163) 2025-05-26 14:41:42 -07:00
test_azure_sentinel.py [Feat] New Logging Integration - Azure Sentinel Logger (#18146) 2025-12-18 02:04:49 +05:30
test_braintrust_logging.py [Bug]: Fix tests to reference moved attributes in braintrust_logging module (#13978) 2025-08-26 18:58:16 -07:00
test_braintrust_span_name.py Add details in docs (#15721) 2025-10-21 16:57:51 -07:00
test_custom_guardrail.py Add GDPR Art. 32 EU PII Protection Policy Template (#21340) 2026-02-16 15:28:46 -08:00
test_custom_guardrail_recursion.py fix: recursive pydantic issue (#19531) 2026-01-22 19:56:41 -08:00
test_custom_prompt_management.py [Fix] CI/CD - Fix failing proxy and core integration tests (#17926) 2025-12-13 10:11:01 -08:00
test_deepeval.py fix: use fastuuid helper (#14903) 2025-09-25 15:47:01 -07:00
test_langfuse.py fix: improve Langfuse test isolation to prevent flaky failures (#21093) 2026-02-16 18:26:37 +05:30
test_langfuse_otel.py Litellm fix langfuse otel trace (#20382) 2026-02-03 22:40:19 -08:00
test_langsmith_init.py fix(langsmith.py): add langsmith_sampling_rate as a dynamic param 2025-09-17 17:32:26 -07:00
test_mlflow.py Fix: MLflow streaming spans for Anthropic passthrough (#17288) 2025-12-05 14:59:36 -08:00
test_openmeter.py [Bug]: Set user from token user_id for OpenMeter integration 2025-07-30 22:23:30 +02:00
test_opentelemetry.py fix(otel): auto-infer otlp_http exporter when endpoint is configured (#20438) 2026-02-10 09:33:16 -08:00
test_opentelemetry_dynamic_imports.py Make grpc dependency optional (#19447) 2026-01-20 19:03:52 -08:00
test_prometheus_cache_metrics.py feat(prometheus): add caching metrics (#18755) 2026-01-07 21:29:04 +05:30
test_prometheus_client_ip_user_agent.py feat: add clientip and user agent in metrics (#19717) 2026-01-25 23:07:19 -08:00
test_prometheus_invalid_key_filtering.py refactor(prometheus): skip metrics for invalid API key requests (#18788) 2026-01-07 17:14:14 -08:00
test_prometheus_labels.py fix(prometheus): sanitize label values to prevent metric scrape failures (#20600) 2026-02-09 15:48:59 -08:00
test_prometheus_metric_name_consistency.py fix: align prometheus metric names with DEFINED_PROMETHEUS_METRICS (#18463) 2026-01-04 00:48:09 +05:30
test_prometheus_missing_metrics.py add callbacks and labels to prometheus (#19708) 2026-01-25 23:03:23 -08:00
test_prometheus_queue_guardrail_metrics.py feat: Add Prometheus metrics for request queue time and guardrails (#17973) 2026-01-06 23:50:11 +05:30
test_prometheus_services.py fix(proxy): resolve high CPU when router_settings in DB by avoiding REGISTRY.collect() in PrometheusServicesLogger (#20087) 2026-01-30 14:01:45 -08:00
test_prometheus_user_team_metrics.py Metrics prometheus user team count (#19520) 2026-01-22 08:17:15 -08:00
test_responses_background_cost.py test: Fix flaky tests with proper mocking and skip conditions 2026-02-15 13:08:30 -03:00
test_s3_v2.py Merge pull request #21157 from Point72/ephrimstanley/s3-logger-skip-missing-standard-logging-object 2026-02-16 18:29:59 +05:30
test_weave_otel.py feat: Basic Weave OTEL integration (#17439) 2025-12-03 21:26:22 -08:00