code: def test_basic_auth_fallback(self):
      token = "Basic " + b64encode(b"test:test").decode()
      clear_db_pools()
  
      # request uses session
      admin_user = client_with_login(
          self.app, username="test", password="test"
      )
      response = admin_user.get("/api/v1/pools")
      assert response.status_code == 200
  
      # request uses basic auth
      with self.app.test_client() as test_client:
          response = test_client.get(
              "/api/v1/pools", headers={"Authorization": token}
          )
          assert response.status_code == 200
  
      # request without session or basic auth header
      with self.app.test_client() as test_client:
          response = test_client.get("/api/v1/pools")
          assert response.status_code == 401
  
imports: from __future__ import annotations
  from base64 import b64encode
  import pytest
  from flask_login import current_user
  from tests.test_utils.api_connexion_utils import assert_401
  from tests.test_utils.config import conf_vars
  from tests.test_utils.db import clear_db_pools
  from tests.test_utils.www import client_with_login
label_desc: Use image node_id 2 for calling the TestSessionWithBasicAuthFallback obj's underlying member method code with example usage: obj.test_basic_auth_fallback() without return types