Fix failing tests

This commit is contained in:
Raphael Michel
2020-08-26 16:33:31 +02:00
parent 6e76db40ed
commit a635ea527e
9 changed files with 42 additions and 42 deletions

View File

@@ -633,7 +633,7 @@ def seat(event, organizer, item):
event.seat_category_mappings.create(
layout_category='Stalls', product=item
)
return event.seats.create(name="A1", product=item, seat_guid="A1")
return event.seats.create(seat_number="A1", product=item, seat_guid="A1")
@pytest.mark.django_db
@@ -665,7 +665,7 @@ def test_cartpos_create_with_blocked_seat(token_client, organizer, event, item,
), format='json', data=res
)
assert resp.status_code == 400
assert resp.data == ['The selected seat "A1" is not available.']
assert resp.data == ['The selected seat "Seat A1" is not available.']
@pytest.mark.django_db
@@ -700,7 +700,7 @@ def test_cartpos_create_with_used_seat(token_client, organizer, event, item, quo
), format='json', data=res
)
assert resp.status_code == 400
assert resp.data == ['The selected seat "A1" is not available.']
assert resp.data == ['The selected seat "Seat A1" is not available.']
@pytest.mark.django_db

View File

@@ -257,7 +257,7 @@ TEST_ORDER_RES = {
@pytest.mark.django_db
def test_order_list_filter_subevent_date(token_client, organizer, event, order, item, taxrule, subevent, question):
res = dict(TEST_ORDER_RES)
res = copy.deepcopy(TEST_ORDER_RES)
with scopes_disabled():
res["positions"][0]["id"] = order.positions.first().pk
p = order.positions.first()
@@ -368,7 +368,7 @@ def test_order_detail(token_client, organizer, event, order, item, taxrule, ques
resp = token_client.get('/api/v1/organizers/{}/events/{}/orders/{}/'.format(organizer.slug, event.slug,
order.code))
assert resp.status_code == 200
assert res == resp.data
assert json.loads(json.dumps(res)) == json.loads(json.dumps(resp.data))
order.status = 'p'
order.save()
@@ -716,7 +716,7 @@ def test_orderposition_list(token_client, organizer, event, order, item, subeven
with scopes_disabled():
var = item.variations.create(value="Children")
var2 = item.variations.create(value="Children")
res = dict(TEST_ORDERPOSITION_RES)
res = copy.copy(TEST_ORDERPOSITION_RES)
op = order.positions.first()
op.variation = var
op.save()
@@ -3089,7 +3089,7 @@ def seat(event, organizer, item):
event.seat_category_mappings.create(
layout_category='Stalls', product=item
)
return event.seats.create(name="A1", product=item, seat_guid="A1")
return event.seats.create(seat_number="A1", product=item, seat_guid="A1")
@pytest.mark.django_db
@@ -3144,7 +3144,7 @@ def test_order_create_with_blocked_seat(token_client, organizer, event, item, qu
assert resp.status_code == 400
assert resp.data == {
'positions': [
{'seat': ['The selected seat "A1" is not available.']},
{'seat': ['The selected seat "Seat A1" is not available.']},
]
}
@@ -3167,7 +3167,7 @@ def test_order_create_with_used_seat(token_client, organizer, event, item, quota
assert resp.status_code == 400
assert resp.data == {
'positions': [
{'seat': ['The selected seat "A1" is not available.']},
{'seat': ['The selected seat "Seat A1" is not available.']},
]
}
@@ -3269,7 +3269,7 @@ def test_order_create_with_duplicate_seat(token_client, organizer, event, item,
assert resp.data == {
'positions': [
{},
{'seat': ['The selected seat "A1" is not available.']},
{'seat': ['The selected seat "Seat A1" is not available.']},
]
}
@@ -3660,8 +3660,8 @@ def test_order_create_voucher_redeemed_partially(token_client, organizer, event,
with scopes_disabled():
voucher = event.vouchers.create(price_mode="set", value=15, item=item, redeemed=1, max_usages=2)
res['positions'][0]['voucher'] = voucher.code
res['positions'].append(copy.copy(res['positions'][0]))
res['positions'].append(copy.copy(res['positions'][0]))
res['positions'].append(copy.deepcopy(res['positions'][0]))
res['positions'].append(copy.deepcopy(res['positions'][0]))
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/'.format(
organizer.slug, event.slug

View File

@@ -1068,7 +1068,7 @@ def seatingplan(organizer, event):
@pytest.fixture
def seat1(item, event):
return event.seats.create(name="A1", product=item, seat_guid="A1")
return event.seats.create(seat_number="A1", product=item, seat_guid="A1")
@pytest.mark.django_db
@@ -1220,8 +1220,8 @@ def test_set_seat_subevent(token_client, organizer, event, seatingplan, seat1, i
event.save()
se1 = event.subevents.create(name="Foobar", date_from=datetime.datetime(2017, 12, 27, 10, 0, 0, tzinfo=UTC))
se2 = event.subevents.create(name="Baz", date_from=datetime.datetime(2017, 12, 27, 10, 0, 0, tzinfo=UTC))
seat1 = event.seats.create(name="A1", product=item, seat_guid="A1", subevent=se1)
event.seats.create(name="A1", product=item, seat_guid="A1", subevent=se2)
seat1 = event.seats.create(seat_number="A1", product=item, seat_guid="A1", subevent=se1)
event.seats.create(seat_number="A1", product=item, seat_guid="A1", subevent=se2)
v = event.vouchers.create(item=item)
change_voucher(
token_client, organizer, event, v,
@@ -1243,8 +1243,8 @@ def test_set_seat_subevent_required(token_client, organizer, event, seatingplan,
event.save()
se1 = event.subevents.create(name="Foobar", date_from=datetime.datetime(2017, 12, 27, 10, 0, 0, tzinfo=UTC))
se2 = event.subevents.create(name="Baz", date_from=datetime.datetime(2017, 12, 27, 10, 0, 0, tzinfo=UTC))
seat1 = event.seats.create(name="A1", product=item, seat_guid="A1", subevent=se1)
event.seats.create(name="A1", product=item, seat_guid="A1", subevent=se2)
seat1 = event.seats.create(seat_number="A1", product=item, seat_guid="A1", subevent=se1)
event.seats.create(seat_number="A1", product=item, seat_guid="A1", subevent=se2)
event.vouchers.create(item=item, seat=seat1)
v = event.vouchers.create(item=item)
change_voucher(
@@ -1263,8 +1263,8 @@ def test_set_seat_subevent_invalid(token_client, organizer, event, seatingplan,
event.save()
se1 = event.subevents.create(name="Foobar", date_from=datetime.datetime(2017, 12, 27, 10, 0, 0, tzinfo=UTC))
se2 = event.subevents.create(name="Baz", date_from=datetime.datetime(2017, 12, 27, 10, 0, 0, tzinfo=UTC))
seat1 = event.seats.create(name="A1", product=item, seat_guid="A1", subevent=se1)
event.seats.create(name="B1", product=item, seat_guid="B1", subevent=se2)
seat1 = event.seats.create(seat_number="A1", product=item, seat_guid="A1", subevent=se1)
event.seats.create(seat_number="B1", product=item, seat_guid="B1", subevent=se2)
event.vouchers.create(item=item, seat=seat1, subevent=se2)
v = event.vouchers.create(item=item)
change_voucher(

View File

@@ -2285,8 +2285,8 @@ class SeatingTestCase(TestCase):
self.event.seat_category_mappings.create(
layout_category='Stalls', product=self.ticket
)
self.seat_a1 = self.event.seats.create(name="A1", product=self.ticket, blocked=False, x=0, y=0)
self.seat_a2 = self.event.seats.create(name="A2", product=self.ticket, blocked=False, x=1, y=1)
self.seat_a1 = self.event.seats.create(seat_number="A1", product=self.ticket, blocked=False, x=0, y=0)
self.seat_a2 = self.event.seats.create(seat_number="A2", product=self.ticket, blocked=False, x=1, y=1)
@classscope(attr='organizer')
def test_free(self):

View File

@@ -551,7 +551,7 @@ def test_import_seat_blocked(user, event, item):
event.seat_category_mappings.create(
layout_category='Stalls', product=item
)
event.seats.create(name="Test", product=item, seat_guid="Test", blocked=True)
event.seats.create(seat_number="Test", product=item, seat_guid="Test", blocked=True)
with pytest.raises(DataImportError) as excinfo:
import_orders.apply(
args=(event.pk, inputfile_factory().id, settings, 'en', user.pk)
@@ -570,7 +570,7 @@ def test_import_seat_dbl(user, event, item):
event.seat_category_mappings.create(
layout_category='Stalls', product=item
)
event.seats.create(name="Test", product=item, seat_guid="Test")
event.seats.create(seat_number="Test", product=item, seat_guid="Test")
with pytest.raises(DataImportError) as excinfo:
import_orders.apply(
args=(event.pk, inputfile_factory().id, settings, 'en', user.pk)
@@ -589,9 +589,9 @@ def test_import_seat(user, event, item):
event.seat_category_mappings.create(
layout_category='Stalls', product=item
)
s1 = event.seats.create(name="Foo", product=item, seat_guid="Foo")
s2 = event.seats.create(name="Bar", product=item, seat_guid="Bar")
s3 = event.seats.create(name="Baz", product=item, seat_guid="Baz")
s1 = event.seats.create(seat_number="Foo", product=item, seat_guid="Foo")
s2 = event.seats.create(seat_number="Bar", product=item, seat_guid="Bar")
s3 = event.seats.create(seat_number="Baz", product=item, seat_guid="Baz")
import_orders.apply(
args=(event.pk, inputfile_factory().id, settings, 'en', user.pk)
).get()

View File

@@ -782,9 +782,9 @@ class OrderChangeManagerTests(TestCase):
layout_category='Stalls', product=self.stalls
)
self.quota.items.add(self.stalls)
self.seat_a1 = self.event.seats.create(name="A1", product=self.stalls, seat_guid="A1")
self.seat_a2 = self.event.seats.create(name="A2", product=self.stalls, seat_guid="A2")
self.seat_a3 = self.event.seats.create(name="A3", product=self.stalls, seat_guid="A3")
self.seat_a1 = self.event.seats.create(seat_number="A1", product=self.stalls, seat_guid="A1")
self.seat_a2 = self.event.seats.create(seat_number="A2", product=self.stalls, seat_guid="A2")
self.seat_a3 = self.event.seats.create(seat_number="A3", product=self.stalls, seat_guid="A3")
def _enable_reverse_charge(self):
self.tr7.eu_reverse_charge = True
@@ -2683,7 +2683,7 @@ class OrderReactivateTest(TestCase):
self.quota = self.event.quotas.create(name='Test', size=None)
self.quota.items.add(self.stalls)
self.quota.items.add(self.ticket)
self.seat_a1 = self.event.seats.create(name="A1", product=self.stalls, seat_guid="A1")
self.seat_a1 = self.event.seats.create(seat_number="A1", product=self.stalls, seat_guid="A1")
generate_invoice(self.order)
djmail.outbox = []

View File

@@ -758,7 +758,7 @@ def test_order_extend_expired_seat_free(client, env):
o.status = Order.STATUS_EXPIRED
o.save()
generate_cancellation(generate_invoice(o))
seat_a1 = env[0].seats.create(name="A1", product=env[3], seat_guid="A1")
seat_a1 = env[0].seats.create(seat_number="A1", product=env[3], seat_guid="A1")
p = o.positions.first()
p.seat = seat_a1
p.save()
@@ -786,7 +786,7 @@ def test_order_extend_expired_seat_blocked(client, env):
o.status = Order.STATUS_EXPIRED
olddate = o.expires
o.save()
seat_a1 = env[0].seats.create(name="A1", product=env[3], seat_guid="A1", blocked=True)
seat_a1 = env[0].seats.create(seat_number="A1", product=env[3], seat_guid="A1", blocked=True)
p = o.positions.first()
p.seat = seat_a1
p.save()
@@ -813,7 +813,7 @@ def test_order_extend_expired_seat_taken(client, env):
o.status = Order.STATUS_EXPIRED
olddate = o.expires
o.save()
seat_a1 = env[0].seats.create(name="A1", product=env[3], seat_guid="A1")
seat_a1 = env[0].seats.create(seat_number="A1", product=env[3], seat_guid="A1")
p = o.positions.first()
p.seat = seat_a1
p.save()
@@ -1043,7 +1043,7 @@ def test_order_mark_paid_expired_seat_taken(client, env):
o.status = Order.STATUS_EXPIRED
olddate = o.expires
o.save()
seat_a1 = env[0].seats.create(name="A1", product=env[3], seat_guid="A1")
seat_a1 = env[0].seats.create(seat_number="A1", product=env[3], seat_guid="A1")
p = o.positions.first()
p.seat = seat_a1
p.save()

View File

@@ -3587,9 +3587,9 @@ class CartSeatingTest(CartTestMixin, TestCase):
self.event.seat_category_mappings.create(
layout_category='Stalls', product=self.ticket
)
self.seat_a1 = self.event.seats.create(name="A1", product=self.ticket, seat_guid="A1")
self.seat_a2 = self.event.seats.create(name="A2", product=self.ticket, seat_guid="A2")
self.seat_a3 = self.event.seats.create(name="A3", product=self.ticket, seat_guid="A3")
self.seat_a1 = self.event.seats.create(seat_number="A1", product=self.ticket, seat_guid="A1")
self.seat_a2 = self.event.seats.create(seat_number="A2", product=self.ticket, seat_guid="A2")
self.seat_a3 = self.event.seats.create(seat_number="A3", product=self.ticket, seat_guid="A3")
self.cm = CartManager(event=self.event, cart_id=self.session_key)
def test_add_with_seat_without_variation(self):
@@ -3649,7 +3649,7 @@ class CartSeatingTest(CartTestMixin, TestCase):
with scopes_disabled():
v = self.event.vouchers.create(item=self.ticket, seat=self.seat_a1)
self.client.post('/%s/%s/cart/add' % (self.orga.slug, self.event.slug), {
'seat_%d' % self.ticket.id: self.seat_a1,
'seat_%d' % self.ticket.id: self.seat_a1.seat_guid,
'_voucher_code': v.code,
}, follow=True)
with scopes_disabled():
@@ -3662,7 +3662,7 @@ class CartSeatingTest(CartTestMixin, TestCase):
with scopes_disabled():
v = self.event.vouchers.create(item=self.ticket, seat=self.seat_a1)
self.client.post('/%s/%s/cart/add' % (self.orga.slug, self.event.slug), {
'seat_%d' % self.ticket.id: self.seat_a2,
'seat_%d' % self.ticket.id: self.seat_a2.seat_guid,
'_voucher_code': v.code,
}, follow=True)
with scopes_disabled():

View File

@@ -3220,9 +3220,9 @@ class CheckoutSeatingTest(BaseCheckoutTestCase, TestCase):
self.event.seat_category_mappings.create(
layout_category='Stalls', product=self.ticket
)
self.seat_a1 = self.event.seats.create(name="A1", product=self.ticket, seat_guid="A1")
self.seat_a2 = self.event.seats.create(name="A2", product=self.ticket, seat_guid="A2")
self.seat_a3 = self.event.seats.create(name="A3", product=self.ticket, seat_guid="A3")
self.seat_a1 = self.event.seats.create(seat_number="A1", product=self.ticket, seat_guid="A1")
self.seat_a2 = self.event.seats.create(seat_number="A2", product=self.ticket, seat_guid="A2")
self.seat_a3 = self.event.seats.create(seat_number="A3", product=self.ticket, seat_guid="A3")
self.cp1 = CartPosition.objects.create(
event=self.event, cart_id=self.session_key, item=self.ticket,
price=21.5, expires=now() + timedelta(minutes=10), seat=self.seat_a1