# Quick Sync Test Guide ## 🚀 5-Minute Test ### Prerequisites - WordPress plugin installed on site - Backend running with new code - IGNY8 account with API key generated in Django admin ### Test Steps #### 1. Backend Ready ✅ ```bash # Verify backend has new endpoint cd /data/app/igny8 docker-compose restart backend sleep 5 docker logs backend | grep "update-structure" || echo "Checking..." ``` #### 2. Connect Plugin 🔌 1. Go to: `WordPress Admin → Settings → IGNY8 API` 2. Enter: - Email: `dev@igny8.com` (your IGNY8 email) - API Key: (from Django admin Sites → Generate WordPress API Keys) - Password: (your IGNY8 password) 3. Click: **Connect to IGNY8** 4. Expected: ✅ "Successfully connected..." #### 3. Check Structure Synced 📊 ```bash # Check WordPress logs tail -20 /path/to/wordpress/wp-content/debug.log | grep "IGNY8" # Should show: # IGNY8: Site structure synced successfully. # IGNY8 DEBUG RESPONSE: Status=200 ``` #### 4. Verify Backend 🔍 ```bash # Check backend database docker exec -it igny8_backend python manage.py shell from igny8_core.business.integration.models import SiteIntegration si = SiteIntegration.objects.filter(platform='wordpress').first() print(si.config_json.get('content_types', {}).keys()) # Should output: dict_keys(['post_types', 'taxonomies', 'last_structure_fetch']) ``` #### 5. Check Frontend 🌐 1. Go to: `https://app.igny8.com/sites/5/settings?tab=content-types` 2. Expected to see: - ✅ Post Types section with: Posts, Pages, Products (or your site's types) - ✅ Taxonomies section with: Categories, Tags, Product Categories - ✅ "Last structure fetch: just now" (or recent timestamp) --- ## ✅ Success Criteria | Step | Expected | Status | |------|----------|--------| | Connection | "Successfully connected" | ✅ | | Plugin logs | "Site structure synced" | ✅ | | Backend config | content_types populated | ✅ | | Frontend tab | Post types & taxonomies visible | ✅ | | Counts | Accurate post/taxonomy counts | ✅ | --- ## ❌ Troubleshooting ### "Connection failed" - [ ] API key correct? (Check Django admin) - [ ] Site ID in backend? (Check Site model) - [ ] Backend restarted? `docker-compose restart backend` ### Structure not syncing - [ ] Check WordPress debug.log for errors - [ ] Is `igny8_get_site_structure()` being called? - [ ] Integration exists in backend? `SiteIntegration.objects.all()` ### Frontend still empty - [ ] Is integration config populated? - [ ] Try: `curl https://api.igny8.com/api/v1/integration/integrations/123/content-types/` - [ ] Refresh browser cache (Ctrl+Shift+Delete) ### Endpoint 404 - [ ] Backend code updated? - [ ] Django migrations run? `docker exec igny8_backend python manage.py migrate` - [ ] Backend container restarted? --- ## 🔧 Manual Test (via API) ### 1. Get Integration ID ```bash curl -H "Authorization: Bearer {YOUR_API_KEY}" \ https://api.igny8.com/api/v1/integration/integrations/?site=5 ``` Get `id` from response. ### 2. Push Structure Manually ```bash curl -X POST \ -H "Authorization: Bearer {YOUR_API_KEY}" \ -H "Content-Type: application/json" \ https://api.igny8.com/api/v1/integration/integrations/{INTEGRATION_ID}/update-structure/ \ -d '{ "post_types": { "post": {"label": "Posts", "count": 10, "enabled": true, "fetch_limit": 100} }, "taxonomies": { "category": {"label": "Categories", "count": 5, "enabled": true, "fetch_limit": 100} }, "plugin_connection_enabled": true, "two_way_sync_enabled": true }' ``` Expected: 200 OK with success message ### 3. Verify Structure Stored ```bash curl -H "Authorization: Bearer {YOUR_API_KEY}" \ https://api.igny8.com/api/v1/integration/integrations/{INTEGRATION_ID}/content-types/ ``` Expected: Response with post_types and taxonomies --- ## 📋 Checklist - [ ] Backend restarted - [ ] Plugin connected successfully - [ ] WordPress debug.log shows structure sync - [ ] Backend database has content_types - [ ] Frontend Content Types tab shows data - [ ] Counts are accurate - [ ] Sync status showing "Connected" --- _Run this test after applying the sync fix!_