Major WHOOSH system refactoring and feature enhancements
- Migrated from HIVE branding to WHOOSH across all components - Enhanced backend API with new services: AI models, BZZZ integration, templates, members - Added comprehensive testing suite with security, performance, and integration tests - Improved frontend with new components for project setup, AI models, and team management - Updated MCP server implementation with WHOOSH-specific tools and resources - Enhanced deployment configurations with production-ready Docker setups - Added comprehensive documentation and setup guides - Implemented age encryption service and UCXL integration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
		
							
								
								
									
										267
									
								
								test_gitea_integration.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										267
									
								
								test_gitea_integration.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,267 @@ | ||||
| #!/usr/bin/env python3 | ||||
| """ | ||||
| Test script for WHOOSH GITEA integration. | ||||
| Verifies that the GiteaService can connect to and interact with the GITEA instance. | ||||
| """ | ||||
| import sys | ||||
| import os | ||||
| import json | ||||
| from pathlib import Path | ||||
|  | ||||
| # Add the backend to Python path | ||||
| sys.path.append(str(Path(__file__).parent / "backend")) | ||||
|  | ||||
| from app.services.gitea_service import GiteaService | ||||
|  | ||||
| def test_gitea_connection(): | ||||
|     """Test basic GITEA connection and API access.""" | ||||
|     print("🔧 Testing GITEA Integration") | ||||
|     print("=" * 50) | ||||
|      | ||||
|     try: | ||||
|         # Initialize GITEA service | ||||
|         gitea = GiteaService() | ||||
|         print(f"✅ GITEA Service initialized") | ||||
|         print(f"   Base URL: {gitea.gitea_base_url}") | ||||
|         print(f"   API URL: {gitea.gitea_api_base}") | ||||
|         print(f"   Token available: {'Yes' if gitea.gitea_token else 'No'}") | ||||
|          | ||||
|         if not gitea.gitea_token: | ||||
|             print("⚠️  Warning: No GITEA token found. Limited functionality available.") | ||||
|             return False | ||||
|          | ||||
|         # Test API connectivity by listing user repositories | ||||
|         print("\n📋 Testing repository listing...") | ||||
|         repositories = gitea.list_repositories() | ||||
|         print(f"✅ Found {len(repositories)} repositories") | ||||
|          | ||||
|         if repositories: | ||||
|             print("   Sample repositories:") | ||||
|             for repo in repositories[:3]:  # Show first 3 | ||||
|                 print(f"     - {repo['full_name']} ({repo['html_url']})") | ||||
|          | ||||
|         # Test repository validation for existing repo | ||||
|         if repositories: | ||||
|             sample_repo = repositories[0] | ||||
|             owner, repo_name = sample_repo['full_name'].split('/', 1) | ||||
|              | ||||
|             print(f"\n🔍 Testing repository validation for {sample_repo['full_name']}...") | ||||
|             validation = gitea.validate_repository_access(owner, repo_name) | ||||
|              | ||||
|             if validation["accessible"]: | ||||
|                 print("✅ Repository validation successful") | ||||
|                 print(f"   BZZZ labels configured: {validation['bzzz_labels_configured']}") | ||||
|                 print(f"   BZZZ task count: {validation['bzzz_task_count']}") | ||||
|                 print(f"   BZZZ ready: {validation['bzzz_ready']}") | ||||
|             else: | ||||
|                 print(f"❌ Repository validation failed: {validation.get('error')}") | ||||
|          | ||||
|         return True | ||||
|          | ||||
|     except Exception as e: | ||||
|         print(f"❌ GITEA integration test failed: {e}") | ||||
|         return False | ||||
|  | ||||
| def test_project_setup_simulation(): | ||||
|     """Simulate a project setup without actually creating a repository.""" | ||||
|     print("\n🚀 Testing Project Setup Simulation") | ||||
|     print("=" * 50) | ||||
|      | ||||
|     try: | ||||
|         gitea = GiteaService() | ||||
|          | ||||
|         # Test project data | ||||
|         project_data = { | ||||
|             "name": "test-whoosh-project", | ||||
|             "description": "Test project for WHOOSH GITEA integration", | ||||
|             "owner": "test-user", | ||||
|             "private": False | ||||
|         } | ||||
|          | ||||
|         print(f"📝 Project data prepared:") | ||||
|         print(f"   Name: {project_data['name']}") | ||||
|         print(f"   Description: {project_data['description']}") | ||||
|         print(f"   Owner: {project_data['owner']}") | ||||
|         print(f"   Private: {project_data['private']}") | ||||
|          | ||||
|         # Test BZZZ label configuration (without creating repo) | ||||
|         print("\n🏷️  Testing BZZZ label configuration...") | ||||
|         expected_labels = [ | ||||
|             gitea.bzzz_labels["task"], | ||||
|             gitea.bzzz_labels["in_progress"],  | ||||
|             gitea.bzzz_labels["completed"], | ||||
|             gitea.bzzz_labels["frontend"], | ||||
|             gitea.bzzz_labels["backend"], | ||||
|             gitea.bzzz_labels["security"] | ||||
|         ] | ||||
|          | ||||
|         print(f"✅ BZZZ labels configured:") | ||||
|         for label in expected_labels: | ||||
|             print(f"     - {label}") | ||||
|          | ||||
|         # Test task type determination | ||||
|         print("\n🔍 Testing task type determination...") | ||||
|         test_issues = [ | ||||
|             {"title": "Fix login bug", "body": "User authentication is broken", "labels": [{"name": "bug"}]}, | ||||
|             {"title": "Add dark mode", "body": "Implement dark theme for UI", "labels": [{"name": "frontend"}, {"name": "enhancement"}]}, | ||||
|             {"title": "Security audit", "body": "Review authentication system", "labels": [{"name": "security"}]}, | ||||
|             {"title": "API optimization", "body": "Improve backend performance", "labels": [{"name": "backend"}]} | ||||
|         ] | ||||
|          | ||||
|         for issue in test_issues: | ||||
|             task_type = gitea._determine_task_type(issue) | ||||
|             print(f"     Issue: '{issue['title']}' → Type: {task_type}") | ||||
|          | ||||
|         print("\n✅ Project setup simulation completed successfully") | ||||
|         return True | ||||
|          | ||||
|     except Exception as e: | ||||
|         print(f"❌ Project setup simulation failed: {e}") | ||||
|         return False | ||||
|  | ||||
| def test_bzzz_integration(): | ||||
|     """Test BZZZ task coordination features.""" | ||||
|     print("\n🐝 Testing BZZZ Integration Features") | ||||
|     print("=" * 50) | ||||
|      | ||||
|     try: | ||||
|         gitea = GiteaService() | ||||
|          | ||||
|         # Test BZZZ task creation data | ||||
|         task_data = { | ||||
|             "title": "🚀 Test BZZZ Task Creation", | ||||
|             "description": """# Test Task for BZZZ Coordination | ||||
|  | ||||
| This is a test task created by the WHOOSH GITEA integration test. | ||||
|  | ||||
| ## Requirements | ||||
| - [ ] Verify task appears in BZZZ agent discovery | ||||
| - [ ] Test task claiming mechanism | ||||
| - [ ] Validate task completion workflow | ||||
|  | ||||
| ## Acceptance Criteria | ||||
| - Task is properly labeled with 'bzzz-task' | ||||
| - Task type is correctly determined | ||||
| - Task can be discovered by BZZZ agents | ||||
|  | ||||
| --- | ||||
| *Created by WHOOSH GITEA Integration Test* | ||||
| """, | ||||
|             "task_type": "testing", | ||||
|             "priority": "medium" | ||||
|         } | ||||
|          | ||||
|         print("📋 Test BZZZ task data prepared:") | ||||
|         print(f"   Title: {task_data['title']}") | ||||
|         print(f"   Type: {task_data['task_type']}") | ||||
|         print(f"   Priority: {task_data['priority']}") | ||||
|          | ||||
|         # Check if we have any repositories to test with | ||||
|         repositories = gitea.list_repositories() | ||||
|         if repositories: | ||||
|             sample_repo = repositories[0] | ||||
|             owner, repo_name = sample_repo['full_name'].split('/', 1) | ||||
|              | ||||
|             print(f"\n🔍 Checking BZZZ tasks in {sample_repo['full_name']}...") | ||||
|             bzzz_tasks = gitea.get_bzzz_tasks(owner, repo_name) | ||||
|             print(f"✅ Found {len(bzzz_tasks)} BZZZ tasks") | ||||
|              | ||||
|             if bzzz_tasks: | ||||
|                 print("   Sample tasks:") | ||||
|                 for task in bzzz_tasks[:3]:  # Show first 3 | ||||
|                     print(f"     - #{task['number']}: {task['title']} (Type: {task['task_type']})") | ||||
|         else: | ||||
|             print("⚠️  No repositories available for BZZZ task testing") | ||||
|          | ||||
|         print("\n✅ BZZZ integration features verified") | ||||
|         return True | ||||
|          | ||||
|     except Exception as e: | ||||
|         print(f"❌ BZZZ integration test failed: {e}") | ||||
|         return False | ||||
|  | ||||
| def print_gitea_configuration_info(): | ||||
|     """Print GITEA configuration information and setup instructions.""" | ||||
|     print("\n⚙️  GITEA Configuration Information") | ||||
|     print("=" * 50) | ||||
|      | ||||
|     print("🔧 GITEA Connection Details:") | ||||
|     print(f"   Server URL: http://ironwood:3000") | ||||
|     print(f"   API Endpoint: http://ironwood:3000/api/v1") | ||||
|     print(f"   External Access: gitea.deepblack.cloud (via Traefik)") | ||||
|      | ||||
|     print("\n🔑 Token Configuration:") | ||||
|     print("   To enable full functionality, create a GITEA personal access token:") | ||||
|     print("   1. Visit http://ironwood:3000/user/settings/applications") | ||||
|     print("   2. Generate a new token with 'repository' permissions") | ||||
|     print("   3. Save the token to one of these locations:") | ||||
|     print("      - /run/secrets/gitea_token (Docker secret - preferred)") | ||||
|     print("      - /home/tony/AI/secrets/passwords_and_tokens/gitea-token") | ||||
|     print("      - Environment variable: GITEA_TOKEN") | ||||
|      | ||||
|     print("\n🏷️  BZZZ Label Configuration:") | ||||
|     print("   The following labels will be automatically created:") | ||||
|     gitea = GiteaService() | ||||
|     for label_key, label_name in gitea.bzzz_labels.items(): | ||||
|         print(f"     - {label_name}") | ||||
|      | ||||
|     print("\n🔗 Integration Points:") | ||||
|     print("   - Repository creation and management") | ||||
|     print("   - Issue-based task coordination") | ||||
|     print("   - BZZZ agent task discovery") | ||||
|     print("   - Project member collaboration") | ||||
|     print("   - Automated label and workflow setup") | ||||
|  | ||||
| def main(): | ||||
|     """Run all GITEA integration tests.""" | ||||
|     print("🧪 WHOOSH GITEA Integration Test Suite") | ||||
|     print("=" * 60) | ||||
|     print() | ||||
|      | ||||
|     # Run tests | ||||
|     tests = [ | ||||
|         ("GITEA Connection", test_gitea_connection), | ||||
|         ("Project Setup Simulation", test_project_setup_simulation), | ||||
|         ("BZZZ Integration", test_bzzz_integration) | ||||
|     ] | ||||
|      | ||||
|     results = [] | ||||
|     for test_name, test_func in tests: | ||||
|         print(f"\n🧪 Running: {test_name}") | ||||
|         try: | ||||
|             result = test_func() | ||||
|             results.append((test_name, result)) | ||||
|         except Exception as e: | ||||
|             print(f"❌ Test failed with exception: {e}") | ||||
|             results.append((test_name, False)) | ||||
|         print() | ||||
|      | ||||
|     # Print configuration info | ||||
|     print_gitea_configuration_info() | ||||
|      | ||||
|     # Summary | ||||
|     print("\n📊 Test Results Summary") | ||||
|     print("=" * 30) | ||||
|     passed = 0 | ||||
|     for test_name, result in results: | ||||
|         status = "✅ PASS" if result else "❌ FAIL" | ||||
|         print(f"{status} {test_name}") | ||||
|         if result: | ||||
|             passed += 1 | ||||
|      | ||||
|     print(f"\nTests passed: {passed}/{len(results)}") | ||||
|      | ||||
|     if passed == len(results): | ||||
|         print("\n🎉 All tests passed! GITEA integration is ready.") | ||||
|         print("\n🚀 Next steps:") | ||||
|         print("   1. Ensure GITEA token is configured") | ||||
|         print("   2. Test project creation through WHOOSH UI") | ||||
|         print("   3. Verify BZZZ agents can discover tasks") | ||||
|         return True | ||||
|     else: | ||||
|         print("\n⚠️  Some tests failed. Please check configuration.") | ||||
|         return False | ||||
|  | ||||
| if __name__ == "__main__": | ||||
|     success = main() | ||||
|     sys.exit(0 if success else 1) | ||||
		Reference in New Issue
	
	Block a user
	 anthonyrawlins
					anthonyrawlins