Skip to content

test: read config via get_config() - #443

Merged
uniqueg merged 1 commit into
devfrom
test/441-get-config
Nov 6, 2026
Merged

uniqueg merged 1 commit into
devfrom
test/441-get-config

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Summary

tests/test_gateway.py::test_backend_entries reads FOCA's configuration via foca.get_config() and get_custom_config(CustomConfig) instead of the deprecated app.app.config.foca (deprecated on FOCA's dev, elixir-cloud-aai/foca#716), as described in FOCA's docs/migration-0.22.md. The test already runs in the app context of the app under test (with app.app.app_context():), so get_config() returns that app's config.

Closes #441

Verification

FOCA 0.21.0 (the locked version, foca>=0.21.0,<0.22) already has get_config() and get_custom_config(), which return the config of current_app in an app context, as on FOCA's dev; the tests already use them elsewhere.

Locally, Python 3.13, locked dependencies (uv sync --locked --extra dev), Helm 3.22.1:

  • ruff check ., ruff format --check . (ruff 0.17.3, as in pre-commit): passed
  • mypy .: no issues in 77 source files
  • ast-grep scan, semgrep --config=.semgrep --error: no findings
  • coverage run -m pytest -W ignore::DeprecationWarning (mongomock): 1614 passed, 11 skipped; coverage 100%
  • With FOCA's dev head (438c8a1) installed, pytest -W default::DeprecationWarning -rw: 1614 passed, 11 skipped; no DeprecationWarning from FOCA (only those of jsonschema, via Connexion and FOCA, and mongomock). The test of dev warns there ('app.config.foca' is deprecated); this one doesn't. FOCA's dev head also logs warnings about Werkzeug classes in the exception map, which is another part of the migration, not this issue.

The MongoDB 7.0 test job ran in CI only.

CI: all checks passed (Lint, Test (mongomock), Test (MongoDB 7.0), Chart, Docs, Smoke test, Scan image, CodeQL, Codecov, CI passed; integration and image pushes skipped as intended on PRs).

Light lane

Test-only change (config access in one test, no behaviour change), so no reviewer subagents; I reviewed the diff myself.

Declined review findings

None.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Migrate the gateway configuration test to FOCA’s supported configuration accessors.

Enhancements:

  • Update the gateway backend configuration test to use FOCA’s current configuration access APIs instead of the deprecated application configuration attribute.

Tests:

  • Modernize configuration access in the gateway backend test without changing application behavior.

Replace the deprecated `app.config.foca` in the gateway tests with
`foca.get_config()` and `get_custom_config()`, in the app context of
the app under test, as in FOCA's migration guide for 0.22.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg uniqueg added this to the v0.6.0 milestone Nov 6, 2026
@uniqueg uniqueg added priority: low Low priority type: testing Related to code testing workload: minutes Likely takes minutes to resolve labels Nov 6, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This test-only change migrates test_backend_entries from the deprecated Flask configuration attribute to FOCA’s get_config() and get_custom_config() APIs, preserving the existing behavior while avoiding deprecation warnings.

File-Level Changes

Change Details Files
Update the gateway backend-entry test to use FOCA’s current configuration accessors within the active application context.
  • Import get_config alongside get_custom_config.
  • Pass the current app configuration to gateway.backend_entries.
  • Assert backend identity against custom configuration retrieved through get_custom_config(CustomConfig), removing use of deprecated app.app.config.foca.
tests/test_gateway.py

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (2ac2094) to head (bd02708).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #443   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           24        24           
  Lines         2685      2685           
=========================================
  Hits          2685      2685           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review November 6, 2026 00:55

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Linked issues

#441 test: stop using deprecated FOCA config access · 1 of 2 met · 1 to check by hand

# Requirement Status Notes
1 Tests read config via get_config() in the app context instead of deprecated access. ✅ Met test_backend_entries uses get_config() and get_custom_config() inside the app's context.
2 The suite passes with pinned FOCA and FOCA's dev head without FOCA deprecation warnings. 👀 Check by hand (runtime) Run the suite with pinned FOCA and FOCA's dev head, confirming both pass without FOCA deprecation warnings.

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@uniqueg
uniqueg merged commit 38ae4e3 into dev Nov 6, 2026
57 of 64 checks passed
@uniqueg
uniqueg deleted the test/441-get-config branch November 6, 2026 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: low Low priority type: testing Related to code testing workload: minutes Likely takes minutes to resolve

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: stop using deprecated FOCA config access

1 participant