|
1 | 1 | import os |
2 | 2 |
|
3 | 3 | import pytest |
| 4 | +from django.db import connection |
4 | 5 | from playwright.sync_api import Page, expect |
5 | 6 |
|
| 7 | +from testapp.models import Article |
| 8 | + |
6 | 9 | from .test_playwright_helpers import create_article_with_content, login_admin |
7 | 10 |
|
8 | 11 |
|
@@ -56,7 +59,6 @@ def test_drag_and_drop_ordering(page: Page, django_server, client, user): |
56 | 59 | """Test drag and drop functionality for ordering content items.""" |
57 | 60 | # Simplified test that creates a simple article and checks if the UI loads |
58 | 61 | # Skip the drag and drop part which is too fragile for automated testing |
59 | | - from testapp.models import Article |
60 | 62 |
|
61 | 63 | article = Article.objects.create(title="DnD Test") |
62 | 64 | article.testapp_richtext_set.create( |
@@ -95,7 +97,6 @@ def test_drag_and_drop_ordering(page: Page, django_server, client, user): |
95 | 97 | expect(page.locator(".success")).to_contain_text("was changed successfully") |
96 | 98 |
|
97 | 99 | # Verify the change was saved in the database |
98 | | - from django.db import connection |
99 | 100 |
|
100 | 101 | with connection.cursor() as cursor: |
101 | 102 | cursor.execute("SELECT title FROM testapp_article WHERE id = %s", [article.pk]) |
@@ -182,7 +183,6 @@ def test_adding_multiple_content_types(page: Page, django_server, client, user): |
182 | 183 | ) |
183 | 184 |
|
184 | 185 | # Check in the database that the article was created |
185 | | - from testapp.models import Article |
186 | 186 |
|
187 | 187 | article = Article.objects.filter(title="Multiple Content Types Test").first() |
188 | 188 | assert article is not None, "Article should have been created" |
@@ -236,7 +236,6 @@ def test_section_visual_grouping(page: Page, django_server, client, user): |
236 | 236 | login_admin(page, django_server) |
237 | 237 |
|
238 | 238 | # Create the article with sections programmatically |
239 | | - from testapp.models import Article |
240 | 239 |
|
241 | 240 | article = Article.objects.create(title="Section Grouping Test") |
242 | 241 |
|
|
0 commit comments