Skip to content

Commit 45d4160

Browse files
committed
fix unit tests by fiddling with ordering
1 parent 9cd0b46 commit 45d4160

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

src/shop/tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ def test_refunded_possible(self):
567567
opr.create_rpr(refund=refund, quantity=1)
568568
opr.save()
569569

570-
# Quantity is 4, but 1 is used and 1 is refunded, so we should be able to refund 4
570+
# Quantity is 5, but 1 is used and 1 is refunded, so we should be able to refund 3
571571
self.assertEqual(opr.possible_refund, 3)
572572

573573

@@ -678,7 +678,7 @@ def test_refund_backoffice_view(self):
678678
# Now to refunding
679679
self.assertEqual(self.opr1.non_refunded_quantity, 5)
680680
form_data = self._get_form_data(
681-
refund_tickets=[self.opr1.shoptickets.order_by("created").first()],
681+
refund_tickets=[self.opr1.shoptickets.latest("created")],
682682
)
683683
response = self.client.post(url, form_data)
684684

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Generated by Django 5.2.9 on 2025-12-23 21:34
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('tickets', '0028_alter_prizeticket_comment'),
10+
]
11+
12+
operations = [
13+
migrations.AlterModelOptions(
14+
name='prizeticket',
15+
options={'ordering': ['-created']},
16+
),
17+
migrations.AlterModelOptions(
18+
name='shopticket',
19+
options={'ordering': ['-created']},
20+
),
21+
migrations.AlterModelOptions(
22+
name='sponsorticket',
23+
options={'ordering': ['-created']},
24+
),
25+
]

src/tickets/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ class BaseTicket(CampRelatedModel, UUIDModel):
155155

156156
class Meta:
157157
abstract = True
158+
ordering = ["-created"]
158159

159160
camp_filter = "ticket_type__camp"
160161

0 commit comments

Comments
 (0)