feat: implement plugin architecture and application settings with Svelte UI
- Added plugin base and loader for backend extensibility - Implemented application settings management with config persistence - Created Svelte-based frontend with Dashboard and Settings pages - Added API routes for plugins, tasks, and settings - Updated documentation and specifications - Improved project structure and developer tools
This commit is contained in:
126
test_update_yamls.py
Normal file → Executable file
126
test_update_yamls.py
Normal file → Executable file
@@ -1,63 +1,63 @@
|
||||
# [DEF:test_update_yamls:Module]
|
||||
#
|
||||
# @SEMANTICS: test, yaml, update, script
|
||||
# @PURPOSE: Test script to verify update_yamls behavior.
|
||||
# @LAYER: Test
|
||||
# @RELATION: DEPENDS_ON -> superset_tool.utils.fileio
|
||||
# @PUBLIC_API: main
|
||||
|
||||
# [SECTION: IMPORTS]
|
||||
import tempfile
|
||||
import os
|
||||
from pathlib import Path
|
||||
import yaml
|
||||
from superset_tool.utils.fileio import update_yamls
|
||||
# [/SECTION]
|
||||
|
||||
# [DEF:main:Function]
|
||||
# @PURPOSE: Main test function.
|
||||
# @RELATION: CALLS -> update_yamls
|
||||
def main():
|
||||
# Create a temporary directory structure
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
tmp_path = Path(tmpdir)
|
||||
|
||||
# Create a mock dashboard directory structure
|
||||
dash_dir = tmp_path / "dashboard"
|
||||
dash_dir.mkdir()
|
||||
|
||||
# Create a mock metadata.yaml file
|
||||
metadata_file = dash_dir / "metadata.yaml"
|
||||
metadata_content = {
|
||||
"dashboard_uuid": "12345",
|
||||
"database_name": "Prod Clickhouse",
|
||||
"slug": "test-dashboard"
|
||||
}
|
||||
with open(metadata_file, 'w') as f:
|
||||
yaml.dump(metadata_content, f)
|
||||
|
||||
print("Original metadata.yaml:")
|
||||
with open(metadata_file, 'r') as f:
|
||||
print(f.read())
|
||||
|
||||
# Test update_yamls
|
||||
db_configs = [
|
||||
{
|
||||
"old": {"database_name": "Prod Clickhouse"},
|
||||
"new": {"database_name": "DEV Clickhouse"}
|
||||
}
|
||||
]
|
||||
|
||||
update_yamls(db_configs=db_configs, path=str(dash_dir))
|
||||
|
||||
print("\nAfter update_yamls:")
|
||||
with open(metadata_file, 'r') as f:
|
||||
print(f.read())
|
||||
|
||||
print("Test completed.")
|
||||
# [/DEF:main]
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
# [/DEF:test_update_yamls]
|
||||
# [DEF:test_update_yamls:Module]
|
||||
#
|
||||
# @SEMANTICS: test, yaml, update, script
|
||||
# @PURPOSE: Test script to verify update_yamls behavior.
|
||||
# @LAYER: Test
|
||||
# @RELATION: DEPENDS_ON -> superset_tool.utils.fileio
|
||||
# @PUBLIC_API: main
|
||||
|
||||
# [SECTION: IMPORTS]
|
||||
import tempfile
|
||||
import os
|
||||
from pathlib import Path
|
||||
import yaml
|
||||
from superset_tool.utils.fileio import update_yamls
|
||||
# [/SECTION]
|
||||
|
||||
# [DEF:main:Function]
|
||||
# @PURPOSE: Main test function.
|
||||
# @RELATION: CALLS -> update_yamls
|
||||
def main():
|
||||
# Create a temporary directory structure
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
tmp_path = Path(tmpdir)
|
||||
|
||||
# Create a mock dashboard directory structure
|
||||
dash_dir = tmp_path / "dashboard"
|
||||
dash_dir.mkdir()
|
||||
|
||||
# Create a mock metadata.yaml file
|
||||
metadata_file = dash_dir / "metadata.yaml"
|
||||
metadata_content = {
|
||||
"dashboard_uuid": "12345",
|
||||
"database_name": "Prod Clickhouse",
|
||||
"slug": "test-dashboard"
|
||||
}
|
||||
with open(metadata_file, 'w') as f:
|
||||
yaml.dump(metadata_content, f)
|
||||
|
||||
print("Original metadata.yaml:")
|
||||
with open(metadata_file, 'r') as f:
|
||||
print(f.read())
|
||||
|
||||
# Test update_yamls
|
||||
db_configs = [
|
||||
{
|
||||
"old": {"database_name": "Prod Clickhouse"},
|
||||
"new": {"database_name": "DEV Clickhouse"}
|
||||
}
|
||||
]
|
||||
|
||||
update_yamls(db_configs=db_configs, path=str(dash_dir))
|
||||
|
||||
print("\nAfter update_yamls:")
|
||||
with open(metadata_file, 'r') as f:
|
||||
print(f.read())
|
||||
|
||||
print("Test completed.")
|
||||
# [/DEF:main]
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
# [/DEF:test_update_yamls]
|
||||
|
||||
Reference in New Issue
Block a user