#!/usr/bin/env python
import os
import django
import json

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'igny8_core.settings')
django.setup()

from igny8_core.business.integration.models import SiteIntegration
from igny8_core.auth.models import Site
from django.test import RequestFactory
from igny8_core.modules.integration.views import IntegrationViewSet

# Create a fake request
factory = RequestFactory()
request = factory.get('/api/v1/integration/integrations/1/content-types/')

# Create view and call the action
integration = SiteIntegration.objects.get(id=1)
viewset = IntegrationViewSet()
viewset.format_kwarg = None
viewset.request = request
viewset.kwargs = {'pk': 1}

# Get the response data
response = viewset.content_types_summary(request, pk=1)

print("Response Status:", response.status_code)
print("\nResponse Data:")
print(json.dumps(response.data, indent=2, default=str))

