SIGN IN SIGN UP

chore(tests): make MFA test package discoverable and resilient

The MFA test directory was missing __init__.py, so
find_modules('pgadmin', False, True) in regression/runtests.py could
not walk into it. The test classes therefore never reached the
TestsGeneratorRegistry registry and the entire pgadmin.authenticate.mfa
test suite was silently absent from the default test run. The
regression for #10028 added in this branch was caught by that gap.

Adding the missing __init__.py exposes a second pre-existing problem:
TestMFATests.setUp called BaseTestGenerator.setUp, which posts to
/browser/server/connect/... and asserts a 200 response. The MFA
scenarios all run against a dummy Flask app (or pure mocks), so that
endpoint is not registered and the connect_server assertion fires
before any check_*() function runs. Skip the BaseTestGenerator setUp
since these scenarios deliberately do not need a real PostgreSQL
server.

Three further fixes that surface once the suite actually runs:

* mfa_enabled() and init_app() both short-circuit when SERVER_MODE
  is False. test_config.json defaults to DESKTOP mode, so every
  scenario in the suite was taking the disabled path. Force
  SERVER_MODE=True for the duration of the TestMFATests class and
  restore the previous value in tearDownClass.

* check_validation_view_content patched flask.current_app to capture
  logger.exception() calls. Those only fire on the POST path of
  /mfa/validate; the test exercises only the GET path, so the patch
  was dead code -- and additionally turned flask.current_app into a
  MagicMock, which broke Jinja's lookup of current_app in
  validate.html. Drop the patch and the now-unused ValidationException
  import.

* check_validation_view_content still cannot render validate.html
  against the bare dummy Flask app because the template references
  current_app.config and extends Flask-Security's
  security/render_page.html, neither of which the dummy app provides.
  Skip the scenario with a clear unittest.SkipTest reason rather than
  paper over with a brittle patch; rebuilding the dummy harness to
  expose those globals is its own follow-up.

Result on this worktree: pgadmin.authenticate.mfa.tests now runs as
12 passed / 0 failed / 1 skipped (the dummy-app/template gap),
up from a silent 0/0/0. Full suite goes from 1806/0/443 to 1818/0/444.
A
Ashesh Vashi committed
2e14bd95ddc321861908a7f546703f808ae644fc
Parent: fff6a48