Cleanup: Remove one-time test files
- Removed test-module-settings.html (manual API test file) - Removed test_urls.py (one-time URL verification script) - Removed test_stage1_refactor.py (stage 1 refactor verification) - Kept proper test suites in tests/ folders
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
"""
|
||||
Test script to verify URL patterns are correctly registered
|
||||
Run this with: python manage.py shell < test_urls.py
|
||||
"""
|
||||
from django.urls import resolve, reverse
|
||||
from django.test import RequestFactory
|
||||
|
||||
# Test URL resolution
|
||||
try:
|
||||
# Test the generate endpoint
|
||||
url_path = '/api/v1/system/settings/integrations/image_generation/generate/'
|
||||
resolved = resolve(url_path)
|
||||
print(f"✅ URL resolved: {url_path}")
|
||||
print(f" View: {resolved.func}")
|
||||
print(f" Args: {resolved.args}")
|
||||
print(f" Kwargs: {resolved.kwargs}")
|
||||
except Exception as e:
|
||||
print(f"❌ URL NOT resolved: {url_path}")
|
||||
print(f" Error: {e}")
|
||||
|
||||
# Test reverse
|
||||
try:
|
||||
reversed_url = reverse('integration-settings-generate', kwargs={'pk': 'image_generation'})
|
||||
print(f"✅ Reverse URL: {reversed_url}")
|
||||
except Exception as e:
|
||||
print(f"❌ Reverse failed: {e}")
|
||||
|
||||
@@ -1,181 +0,0 @@
|
||||
"""
|
||||
Stage 1 Backend Refactor - Basic Tests
|
||||
Test the refactored models and serializers
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from django.test import TestCase
|
||||
from igny8_core.business.planning.models import Clusters
|
||||
from igny8_core.business.content.models import Tasks, Content, ContentTaxonomy
|
||||
from igny8_core.modules.writer.serializers import TasksSerializer, ContentSerializer, ContentTaxonomySerializer
|
||||
|
||||
|
||||
class TestClusterModel(TestCase):
|
||||
"""Test Cluster model after Stage 1 refactor"""
|
||||
|
||||
def test_cluster_fields_removed(self):
|
||||
"""Verify deprecated fields are removed"""
|
||||
cluster = Clusters()
|
||||
|
||||
# These fields should NOT exist
|
||||
assert not hasattr(cluster, 'context_type'), "context_type should be removed"
|
||||
assert not hasattr(cluster, 'dimension_meta'), "dimension_meta should be removed"
|
||||
|
||||
# These fields SHOULD exist
|
||||
assert hasattr(cluster, 'name'), "name field should exist"
|
||||
assert hasattr(cluster, 'keywords'), "keywords field should exist"
|
||||
|
||||
|
||||
class TestTasksModel(TestCase):
|
||||
"""Test Tasks model after Stage 1 refactor"""
|
||||
|
||||
def test_tasks_fields_removed(self):
|
||||
"""Verify deprecated fields are removed"""
|
||||
task = Tasks()
|
||||
|
||||
# These fields should NOT exist
|
||||
assert not hasattr(task, 'cluster_role'), "cluster_role should be removed"
|
||||
assert not hasattr(task, 'idea_id'), "idea_id should be removed"
|
||||
assert not hasattr(task, 'content_record'), "content_record should be removed"
|
||||
assert not hasattr(task, 'entity_type'), "entity_type should be removed"
|
||||
|
||||
def test_tasks_fields_added(self):
|
||||
"""Verify new fields are added"""
|
||||
task = Tasks()
|
||||
|
||||
# These fields SHOULD exist
|
||||
assert hasattr(task, 'content_type'), "content_type should be added"
|
||||
assert hasattr(task, 'content_structure'), "content_structure should be added"
|
||||
assert hasattr(task, 'taxonomy_term_id'), "taxonomy_term_id should be added"
|
||||
|
||||
def test_tasks_status_choices(self):
|
||||
"""Verify status choices are simplified"""
|
||||
# Status should only have 'queued' and 'completed'
|
||||
status_choices = [choice[0] for choice in Tasks._meta.get_field('status').choices]
|
||||
assert 'queued' in status_choices, "queued should be a valid status"
|
||||
assert 'completed' in status_choices, "completed should be a valid status"
|
||||
assert len(status_choices) == 2, "Should only have 2 status choices"
|
||||
|
||||
|
||||
class TestContentModel(TestCase):
|
||||
"""Test Content model after Stage 1 refactor"""
|
||||
|
||||
def test_content_fields_removed(self):
|
||||
"""Verify deprecated fields are removed"""
|
||||
content = Content()
|
||||
|
||||
# These fields should NOT exist
|
||||
assert not hasattr(content, 'task'), "task FK should be removed"
|
||||
assert not hasattr(content, 'html_content'), "html_content should be removed (use content_html)"
|
||||
assert not hasattr(content, 'entity_type'), "entity_type should be removed"
|
||||
assert not hasattr(content, 'cluster_role'), "cluster_role should be removed"
|
||||
assert not hasattr(content, 'sync_status'), "sync_status should be removed"
|
||||
|
||||
def test_content_fields_added(self):
|
||||
"""Verify new fields are added"""
|
||||
content = Content()
|
||||
|
||||
# These fields SHOULD exist
|
||||
assert hasattr(content, 'title'), "title should be added"
|
||||
assert hasattr(content, 'content_html'), "content_html should be added"
|
||||
assert hasattr(content, 'cluster_id'), "cluster_id should be added"
|
||||
assert hasattr(content, 'content_type'), "content_type should be added"
|
||||
assert hasattr(content, 'content_structure'), "content_structure should be added"
|
||||
assert hasattr(content, 'taxonomy_terms'), "taxonomy_terms M2M should exist"
|
||||
|
||||
def test_content_status_choices(self):
|
||||
"""Verify status choices are simplified"""
|
||||
# Status should only have 'draft' and 'published'
|
||||
status_choices = [choice[0] for choice in Content._meta.get_field('status').choices]
|
||||
assert 'draft' in status_choices, "draft should be a valid status"
|
||||
assert 'published' in status_choices, "published should be a valid status"
|
||||
assert len(status_choices) == 2, "Should only have 2 status choices"
|
||||
|
||||
|
||||
class TestContentTaxonomyModel(TestCase):
|
||||
"""Test ContentTaxonomy model after Stage 1 refactor"""
|
||||
|
||||
def test_taxonomy_fields_removed(self):
|
||||
"""Verify deprecated fields are removed"""
|
||||
taxonomy = ContentTaxonomy()
|
||||
|
||||
# These fields should NOT exist
|
||||
assert not hasattr(taxonomy, 'description'), "description should be removed"
|
||||
assert not hasattr(taxonomy, 'parent'), "parent FK should be removed"
|
||||
assert not hasattr(taxonomy, 'sync_status'), "sync_status should be removed"
|
||||
assert not hasattr(taxonomy, 'count'), "count should be removed"
|
||||
assert not hasattr(taxonomy, 'metadata'), "metadata should be removed"
|
||||
assert not hasattr(taxonomy, 'clusters'), "clusters M2M should be removed"
|
||||
|
||||
def test_taxonomy_type_includes_cluster(self):
|
||||
"""Verify taxonomy_type includes 'cluster' option"""
|
||||
type_choices = [choice[0] for choice in ContentTaxonomy._meta.get_field('taxonomy_type').choices]
|
||||
assert 'category' in type_choices, "category should be a valid type"
|
||||
assert 'post_tag' in type_choices, "post_tag should be a valid type"
|
||||
assert 'cluster' in type_choices, "cluster should be a valid type"
|
||||
|
||||
|
||||
class TestTasksSerializer(TestCase):
|
||||
"""Test TasksSerializer after Stage 1 refactor"""
|
||||
|
||||
def test_serializer_fields(self):
|
||||
"""Verify serializer has correct fields"""
|
||||
serializer = TasksSerializer()
|
||||
fields = serializer.fields.keys()
|
||||
|
||||
# Should have new fields
|
||||
assert 'content_type' in fields, "content_type should be in serializer"
|
||||
assert 'content_structure' in fields, "content_structure should be in serializer"
|
||||
assert 'taxonomy_term_id' in fields, "taxonomy_term_id should be in serializer"
|
||||
assert 'cluster_id' in fields, "cluster_id should be in serializer"
|
||||
|
||||
# Should NOT have deprecated fields
|
||||
assert 'idea_title' not in fields, "idea_title should not be in serializer"
|
||||
assert 'cluster_role' not in fields, "cluster_role should not be in serializer"
|
||||
|
||||
|
||||
class TestContentSerializer(TestCase):
|
||||
"""Test ContentSerializer after Stage 1 refactor"""
|
||||
|
||||
def test_serializer_fields(self):
|
||||
"""Verify serializer has correct fields"""
|
||||
serializer = ContentSerializer()
|
||||
fields = serializer.fields.keys()
|
||||
|
||||
# Should have new fields
|
||||
assert 'title' in fields, "title should be in serializer"
|
||||
assert 'content_html' in fields, "content_html should be in serializer"
|
||||
assert 'cluster_id' in fields, "cluster_id should be in serializer"
|
||||
assert 'content_type' in fields, "content_type should be in serializer"
|
||||
assert 'content_structure' in fields, "content_structure should be in serializer"
|
||||
assert 'taxonomy_terms_data' in fields, "taxonomy_terms_data should be in serializer"
|
||||
|
||||
# Should NOT have deprecated fields
|
||||
assert 'task_id' not in fields, "task_id should not be in serializer"
|
||||
assert 'entity_type' not in fields, "entity_type should not be in serializer"
|
||||
assert 'cluster_role' not in fields, "cluster_role should not be in serializer"
|
||||
|
||||
|
||||
class TestContentTaxonomySerializer(TestCase):
|
||||
"""Test ContentTaxonomySerializer after Stage 1 refactor"""
|
||||
|
||||
def test_serializer_fields(self):
|
||||
"""Verify serializer has correct fields"""
|
||||
serializer = ContentTaxonomySerializer()
|
||||
fields = serializer.fields.keys()
|
||||
|
||||
# Should have these fields
|
||||
assert 'id' in fields
|
||||
assert 'name' in fields
|
||||
assert 'slug' in fields
|
||||
assert 'taxonomy_type' in fields
|
||||
|
||||
# Should NOT have deprecated fields
|
||||
assert 'description' not in fields, "description should not be in serializer"
|
||||
assert 'parent' not in fields, "parent should not be in serializer"
|
||||
assert 'sync_status' not in fields, "sync_status should not be in serializer"
|
||||
assert 'cluster_names' not in fields, "cluster_names should not be in serializer"
|
||||
|
||||
|
||||
# Run tests with: python manage.py test igny8_core.modules.writer.tests.test_stage1_refactor
|
||||
# Or with pytest: pytest backend/igny8_core/modules/writer/tests/test_stage1_refactor.py -v
|
||||
Reference in New Issue
Block a user