Allow quotas to "close" when once full (#1344)

* Model

* Some UI

* API and logging

* Permission check

* Add tests

* Move option around
This commit is contained in:
Raphael Michel
2019-07-16 14:02:27 +02:00
committed by GitHub
parent c1e2fb36ba
commit a02ea45dba
16 changed files with 219 additions and 12 deletions

View File

@@ -483,6 +483,24 @@ class QuotaTestCase(BaseQuotaTestCase):
self.event.has_subevents = False
self.event.save()
@classscope(attr='o')
def test_close_when_full_on_calculation(self):
self.quota.close_when_sold_out = True
self.quota.size = 0
self.quota.save()
assert not self.quota.closed
self.quota.availability()
self.quota.refresh_from_db()
assert self.quota.closed
assert self.quota.all_logentries().filter(action_type="pretix.event.quota.closed").exists()
@classscope(attr='o')
def test_closed_reports_as_sold_out(self):
self.quota.closed = True
self.quota.size = 100
self.quota.save()
assert self.quota.availability() == (Quota.AVAILABILITY_ORDERED, 0)
class BundleQuotaTestCase(BaseQuotaTestCase):
def setUp(self):