forked from CGM_Public/pretix_original
fix python linter errors
This commit is contained in:
@@ -6,13 +6,15 @@
|
|||||||
It runs the local frontend server, if node is installed and the setting
|
It runs the local frontend server, if node is installed and the setting
|
||||||
is set.
|
is set.
|
||||||
"""
|
"""
|
||||||
import os
|
|
||||||
import atexit
|
import atexit
|
||||||
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.staticfiles.management.commands.runserver import Command as Parent
|
from django.contrib.staticfiles.management.commands.runserver import (
|
||||||
|
Command as Parent,
|
||||||
|
)
|
||||||
from django.utils.autoreload import DJANGO_AUTORELOAD_ENV
|
from django.utils.autoreload import DJANGO_AUTORELOAD_ENV
|
||||||
|
|
||||||
|
|
||||||
@@ -32,7 +34,7 @@ class Command(Parent):
|
|||||||
vite_server.wait(timeout=5)
|
vite_server.wait(timeout=5)
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
vite_server.kill()
|
vite_server.kill()
|
||||||
|
|
||||||
atexit.register(cleanup)
|
atexit.register(cleanup)
|
||||||
|
|
||||||
super().handle(*args, **options)
|
super().handle(*args, **options)
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ class SecurityMiddleware(MiddlewareMixin):
|
|||||||
'script-src': ["{static}"] + (["http://localhost:5173", "ws://localhost:5173"] if settings.VITE_DEV_MODE else []),
|
'script-src': ["{static}"] + (["http://localhost:5173", "ws://localhost:5173"] if settings.VITE_DEV_MODE else []),
|
||||||
'object-src': ["'none'"],
|
'object-src': ["'none'"],
|
||||||
'frame-src': ['{static}'],
|
'frame-src': ['{static}'],
|
||||||
'style-src': ["{static}", "{media}"]+ (["unsafe-inline"] if settings.VITE_DEV_MODE else []),
|
'style-src': ["{static}", "{media}"] + (["unsafe-inline"] if settings.VITE_DEV_MODE else []),
|
||||||
'connect-src': ["{dynamic}", "{media}"] + (["http://localhost:5173", "ws://localhost:5173"] if settings.VITE_DEV_MODE else []),
|
'connect-src': ["{dynamic}", "{media}"] + (["http://localhost:5173", "ws://localhost:5173"] if settings.VITE_DEV_MODE else []),
|
||||||
'img-src': ["{static}", "{media}", "data:"] + img_src,
|
'img-src': ["{static}", "{media}", "data:"] + img_src,
|
||||||
'font-src': ["{static}"] + list(font_src),
|
'font-src': ["{static}"] + list(font_src),
|
||||||
|
|||||||
@@ -9,16 +9,19 @@ using Playwright. It integrates Playwright with Django's test infrastructure.
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import pytest
|
from datetime import date, datetime, timedelta, timezone
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from datetime import date, datetime, timezone, timedelta
|
|
||||||
from urllib.request import urlopen
|
|
||||||
from urllib.error import URLError
|
from urllib.error import URLError
|
||||||
from playwright.sync_api import Browser, BrowserContext, Page, expect
|
from urllib.request import urlopen
|
||||||
|
|
||||||
|
import pytest
|
||||||
from django_scopes import scopes_disabled
|
from django_scopes import scopes_disabled
|
||||||
|
from playwright.sync_api import ( # noqa: F401
|
||||||
|
Browser, BrowserContext, Page, expect,
|
||||||
|
)
|
||||||
|
|
||||||
from pretix.base.models import (
|
from pretix.base.models import (
|
||||||
Organizer, Event, Item, Quota, ItemVariation, SubEvent, Voucher
|
Event, Item, ItemVariation, Organizer, Quota, SubEvent, Voucher,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Allow Django ORM operations in async context (required for Playwright integration)
|
# Allow Django ORM operations in async context (required for Playwright integration)
|
||||||
@@ -137,6 +140,7 @@ def live_server_url(live_server, settings):
|
|||||||
|
|
||||||
return live_server.url
|
return live_server.url
|
||||||
|
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# Test Data Fixtures - Organizers and Events
|
# Test Data Fixtures - Organizers and Events
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
@@ -740,9 +744,9 @@ def event_series(organizer):
|
|||||||
for i in range(15):
|
for i in range(15):
|
||||||
se = SubEvent.objects.create(
|
se = SubEvent.objects.create(
|
||||||
event=event,
|
event=event,
|
||||||
name=f'Concert Night {i+1}',
|
name=f'Concert Night {i + 1}',
|
||||||
date_from=base_date + timedelta(days=i*2),
|
date_from=base_date + timedelta(days=i * 2),
|
||||||
date_to=base_date + timedelta(days=i*2, hours=2),
|
date_to=base_date + timedelta(days=i * 2, hours=2),
|
||||||
active=True,
|
active=True,
|
||||||
)
|
)
|
||||||
subevents.append(se)
|
subevents.append(se)
|
||||||
@@ -750,7 +754,7 @@ def event_series(organizer):
|
|||||||
# Each subevent needs its own quota
|
# Each subevent needs its own quota
|
||||||
quota = Quota.objects.create(
|
quota = Quota.objects.create(
|
||||||
event=event,
|
event=event,
|
||||||
name=f'Concert {i+1} Quota',
|
name=f'Concert {i + 1} Quota',
|
||||||
size=100,
|
size=100,
|
||||||
subevent=se,
|
subevent=se,
|
||||||
)
|
)
|
||||||
@@ -1035,11 +1039,13 @@ def item_not_yet_available(event):
|
|||||||
@scopes_disabled()
|
@scopes_disabled()
|
||||||
def item_with_picture(event):
|
def item_with_picture(event):
|
||||||
"""Create an item with a product picture."""
|
"""Create an item with a product picture."""
|
||||||
from pretix.base.models import ItemCategory
|
|
||||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
|
||||||
import io
|
import io
|
||||||
|
|
||||||
|
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||||
from PIL import Image as PILImage
|
from PIL import Image as PILImage
|
||||||
|
|
||||||
|
from pretix.base.models import ItemCategory
|
||||||
|
|
||||||
category = ItemCategory.objects.create(
|
category = ItemCategory.objects.create(
|
||||||
event=event,
|
event=event,
|
||||||
name='Gallery Items',
|
name='Gallery Items',
|
||||||
@@ -1113,8 +1119,9 @@ def _register_widget_test_view():
|
|||||||
set_content, which causes CORS issues.
|
set_content, which causes CORS issues.
|
||||||
"""
|
"""
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.views import View
|
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
from django.views import View
|
||||||
|
|
||||||
from pretix.multidomain import maindomain_urlconf as urls
|
from pretix.multidomain import maindomain_urlconf as urls
|
||||||
|
|
||||||
class WidgetTestView(View):
|
class WidgetTestView(View):
|
||||||
|
|||||||
Reference in New Issue
Block a user