mirror of
https://github.com/pretix/pretix.git
synced 2025-12-22 16:52:27 +00:00
Compare commits
2 Commits
validate-u
...
import-.wr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79ecaaa04b | ||
|
|
33462a7a6e |
@@ -175,7 +175,7 @@ class Variation(ImportColumn):
|
|||||||
if value:
|
if value:
|
||||||
matches = [
|
matches = [
|
||||||
p for p in self.items
|
p for p in self.items
|
||||||
if str(p.pk) == value or any((v and v == value) for v in i18n_flat(p.value)) and p.item_id == previous_values['item'].pk
|
if (str(p.pk) == value or any((v and v == value) for v in i18n_flat(p.value))) and p.item_id == previous_values['item'].pk
|
||||||
]
|
]
|
||||||
if len(matches) == 0:
|
if len(matches) == 0:
|
||||||
raise ValidationError(_("No matching variation was found."))
|
raise ValidationError(_("No matching variation was found."))
|
||||||
|
|||||||
@@ -443,6 +443,37 @@ def test_variation_invalid(user, event, item):
|
|||||||
assert 'Error while importing value "Foo" for column "Product variation" in line "1": No matching variation was found.' in str(excinfo.value)
|
assert 'Error while importing value "Foo" for column "Product variation" in line "1": No matching variation was found.' in str(excinfo.value)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db
|
||||||
|
@scopes_disabled()
|
||||||
|
def test_variation_wrong_item(user, event, item):
|
||||||
|
settings = dict(DEFAULT_SETTINGS)
|
||||||
|
settings['item'] = 'static:{}'.format(item.pk)
|
||||||
|
settings['variation'] = 'csv:E'
|
||||||
|
item2 = Item.objects.create(event=event, name="Ticket", default_price=23)
|
||||||
|
v1 = item2.variations.create(value='Foo')
|
||||||
|
data = [{
|
||||||
|
'A': 'Dieter',
|
||||||
|
'B': 'Schneider',
|
||||||
|
'C': 'schneider@example.org',
|
||||||
|
'D': 'Test',
|
||||||
|
'E': str(v1.pk),
|
||||||
|
'F': '0.00',
|
||||||
|
'G': 'US',
|
||||||
|
'H': 'Texas',
|
||||||
|
'I': 'Foo',
|
||||||
|
'J': '2021-06-28 11:00:00',
|
||||||
|
'K': '06221/32177-50',
|
||||||
|
'L': 'True',
|
||||||
|
'M': 'baz',
|
||||||
|
'N': 'Seat-1',
|
||||||
|
}]
|
||||||
|
with pytest.raises(DataImportError) as excinfo:
|
||||||
|
import_orders.apply(
|
||||||
|
args=(event.pk, inputfile_factory(data).id, settings, 'en', user.pk)
|
||||||
|
).get()
|
||||||
|
assert f'Error while importing value "{str(v1.pk)}" for column "Product variation" in line "1": No matching variation was found.' in str(excinfo.value)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
@scopes_disabled()
|
@scopes_disabled()
|
||||||
def test_variation_dynamic(user, event, item):
|
def test_variation_dynamic(user, event, item):
|
||||||
|
|||||||
Reference in New Issue
Block a user