- Update plugins (debug, mapper, search) to explicitly map environment config to SupersetConfig - Add authenticate method to SupersetClient for explicit session management - Add get_environment method to ConfigManager - Fix navbar dropdown hover stability in frontend with invisible bridge
100 lines
3.0 KiB
Python
100 lines
3.0 KiB
Python
#!/usr/bin/env python3
|
|
"""Test script to verify the fixes for SupersetClient initialization."""
|
|
|
|
import sys
|
|
sys.path.insert(0, '.')
|
|
|
|
from src.core.config_manager import ConfigManager
|
|
from src.core.config_models import Environment
|
|
from src.plugins.search import SearchPlugin
|
|
from src.plugins.mapper import MapperPlugin
|
|
from src.plugins.debug import DebugPlugin
|
|
|
|
def test_config_manager():
|
|
"""Test ConfigManager methods."""
|
|
print("Testing ConfigManager...")
|
|
try:
|
|
config_manager = ConfigManager()
|
|
print(f" ConfigManager initialized")
|
|
|
|
# Test get_environment method
|
|
if hasattr(config_manager, 'get_environment'):
|
|
print(f" get_environment method exists")
|
|
|
|
# Add a test environment if none exists
|
|
if not config_manager.has_environments():
|
|
test_env = Environment(
|
|
id="test-env",
|
|
name="Test Environment",
|
|
url="http://localhost:8088",
|
|
username="admin",
|
|
password="admin"
|
|
)
|
|
config_manager.add_environment(test_env)
|
|
print(f" Added test environment: {test_env.name}")
|
|
|
|
# Test retrieving environment
|
|
envs = config_manager.get_environments()
|
|
if envs:
|
|
test_env_id = envs[0].id
|
|
env_config = config_manager.get_environment(test_env_id)
|
|
print(f" Successfully retrieved environment: {env_config.name}")
|
|
return True
|
|
else:
|
|
print(f" No environments available (add one in settings)")
|
|
return False
|
|
|
|
except Exception as e:
|
|
print(f" Error: {e}")
|
|
return False
|
|
|
|
def test_plugins():
|
|
"""Test plugin initialization."""
|
|
print("\nTesting plugins...")
|
|
|
|
plugins = [
|
|
("Search Plugin", SearchPlugin()),
|
|
("Mapper Plugin", MapperPlugin()),
|
|
("Debug Plugin", DebugPlugin())
|
|
]
|
|
|
|
all_ok = True
|
|
|
|
for name, plugin in plugins:
|
|
print(f"\nTesting {name}...")
|
|
try:
|
|
plugin_id = plugin.id
|
|
plugin_name = plugin.name
|
|
plugin_version = plugin.version
|
|
schema = plugin.get_schema()
|
|
|
|
print(f" ✓ ID: {plugin_id}")
|
|
print(f" ✓ Name: {plugin_name}")
|
|
print(f" ✓ Version: {plugin_version}")
|
|
print(f" ✓ Schema: {schema}")
|
|
|
|
except Exception as e:
|
|
print(f" ✗ Error: {e}")
|
|
all_ok = False
|
|
|
|
return all_ok
|
|
|
|
def main():
|
|
"""Main test function."""
|
|
print("=" * 50)
|
|
print("Superset Tools Fix Verification")
|
|
print("=" * 50)
|
|
|
|
config_ok = test_config_manager()
|
|
plugins_ok = test_plugins()
|
|
|
|
print("\n" + "=" * 50)
|
|
if config_ok and plugins_ok:
|
|
print("✅ All fixes verified successfully!")
|
|
else:
|
|
print("❌ Some tests failed")
|
|
sys.exit(1)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|