Revert "Let plugins allow/prevent the download of individual tickets in an order (#3836)"

This reverts commit e20edab98f.
This commit is contained in:
Martin Gross
2024-02-02 16:09:42 +01:00
parent a769da62c7
commit 9d115c30d7
11 changed files with 125 additions and 140 deletions

View File

@@ -55,7 +55,6 @@ from pretix.base.services.orders import (
send_expiry_warnings,
)
from pretix.plugins.banktransfer.payment import BankTransfer
from pretix.testutils.mock import mocker_context
from pretix.testutils.scope import classscope
@@ -821,7 +820,7 @@ class DownloadReminderTests(TestCase):
self.event = Event.objects.create(
organizer=self.o, name='Dummy', slug='dummy',
date_from=now() + timedelta(days=2),
plugins='pretix.plugins.banktransfer,tests.testdummy'
plugins='pretix.plugins.banktransfer'
)
self.order = Order.objects.create(
code='FOO', event=self.event, email='dummy@dummy.test',
@@ -854,58 +853,6 @@ class DownloadReminderTests(TestCase):
send_download_reminders(sender=self.event)
assert len(djmail.outbox) == 0
@classscope(attr='o')
def test_downloads_disabled_by_plugin(self):
with mocker_context() as mocker:
self.event.settings.mail_days_download_reminder = 2
from pretix.base.signals import allow_ticket_download
mocker.patch('pretix.base.signals.allow_ticket_download.send')
allow_ticket_download.send.return_value = [(None, [])]
send_download_reminders(sender=self.event)
assert len(djmail.outbox) == 0
@classscope(attr='o')
def test_downloads_all_allowed_by_plugin(self):
with mocker_context() as mocker:
self.event.settings.mail_days_download_reminder = 2
self.event.settings.mail_attach_tickets = True
self.event.settings.ticketoutput_testdummy__enabled = True
self.op2 = OrderPosition.objects.create(
order=self.order, item=self.ticket, variation=None,
price=Decimal("42.00"), attendee_name_parts={"full_name": "Mary"}, positionid=2
)
from pretix.base.signals import allow_ticket_download
mocker.patch('pretix.base.signals.allow_ticket_download.send')
allow_ticket_download.send.return_value = [(None, True)]
send_download_reminders(sender=self.event)
assert len(djmail.outbox) == 1
assert len(djmail.outbox[0].attachments) == 2
@classscope(attr='o')
def test_downloads_partially_disabled_by_plugin(self):
with mocker_context() as mocker:
self.event.settings.mail_days_download_reminder = 2
self.event.settings.mail_attach_tickets = True
self.event.settings.ticketoutput_testdummy__enabled = True
self.op2 = OrderPosition.objects.create(
order=self.order, item=self.ticket, variation=None,
price=Decimal("42.00"), attendee_name_parts={"full_name": "Mary"}, positionid=2
)
from pretix.base.signals import allow_ticket_download
mocker.patch('pretix.base.signals.allow_ticket_download.send')
allow_ticket_download.send.return_value = [(None, [self.op2])]
send_download_reminders(sender=self.event)
assert len(djmail.outbox) == 1
assert len(djmail.outbox[0].attachments) == 1
@classscope(attr='o')
def test_disabled(self):
send_download_reminders(sender=self.event)

View File

@@ -33,7 +33,3 @@ class DummyTicketOutput(BaseTicketOutput):
def generate(self, op):
return 'test.txt', 'text/plain', str(op.order.id)
@property
def multi_download_enabled(self) -> bool:
return False