def test_url_encode():
    """Test username and password are urlencoded when database URL is generated."""
    username = "user@user"
    password = "pass@pass"
    database = "db"
    username_encoded = urllib.parse.quote_plus(username)
    password_encoded = urllib.parse.quote_plus(password)
    engine = "postgresql"

    db_config = DBConfig(
        engine=engine, username=username, password=password, database=database
    )
    assert (
        db_config.get_url()
        == f"{engine}://{username_encoded}:{password_encoded}@/{database}"
    )
Test username and password are urlencoded when database URL is generated.
tests/units/test_db_config.py