mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Move testdummy plugin to the test directory
This commit is contained in:
18
src/tests/testdummy/__init__.py
Normal file
18
src/tests/testdummy/__init__.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from django.apps import AppConfig
|
||||
from pretix.base.plugins import PluginType
|
||||
|
||||
|
||||
class TestDummyApp(AppConfig):
|
||||
name = 'tests.testdummy'
|
||||
verbose_name = '.testdummy'
|
||||
|
||||
class PretixPluginMeta:
|
||||
type = PluginType.RESTRICTION
|
||||
name = '.testdummy'
|
||||
version = '1.0.0'
|
||||
|
||||
def ready(self):
|
||||
from tests.testdummy import signals
|
||||
|
||||
|
||||
default_app_config = 'tests.testdummy.TestDummyApp'
|
||||
0
src/tests/testdummy/models.py
Normal file
0
src/tests/testdummy/models.py
Normal file
15
src/tests/testdummy/signals.py
Normal file
15
src/tests/testdummy/signals.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from django.dispatch import receiver
|
||||
|
||||
from pretix.base.signals import determine_availability
|
||||
|
||||
|
||||
@receiver(determine_availability)
|
||||
def availability_handler(sender, **kwargs):
|
||||
kwargs['sender'] = sender
|
||||
if sender.settings.testdummy_available is not None:
|
||||
variations = kwargs['variations']
|
||||
variations = [d.copy() for d in variations]
|
||||
for v in variations:
|
||||
v['available'] = (sender.settings.testdummy_available == 'yes')
|
||||
return variations
|
||||
return []
|
||||
Reference in New Issue
Block a user