This commit is contained in:
Mira Weller
2025-04-04 18:44:35 +02:00
parent 63c06dc44a
commit 3b0d75d3a9
2 changed files with 30 additions and 5 deletions

View File

@@ -1,3 +1,25 @@
#
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 Raphael Michel and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as published by the Free Software Foundation in version 3 of the License.
#
# ADDITIONAL TERMS APPLY: Pursuant to Section 7 of the GNU Affero General Public License, additional terms are
# applicable granting you additional permissions and placing additional restrictions on your usage of this software.
# Please refer to the pretix LICENSE file to obtain the full terms applicable to this work. If you did not receive
# this file, see <https://pretix.eu/about/en/license>.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
#
from typing import List, Tuple
from pretix.base.datasync.datasync import (

View File

@@ -28,10 +28,12 @@ import pytest
from django.utils.timezone import now
from django_scopes import scope
from pretix.base.datasync.datasync import OutboundSyncProvider, StaticMapping, MODE_OVERWRITE, MODE_SET_IF_EMPTY, \
MODE_SET_IF_NEW, MODE_APPEND_LIST, sync_all, sync_targets
from pretix.base.datasync.datasync import (
MODE_APPEND_LIST, MODE_OVERWRITE, MODE_SET_IF_EMPTY, MODE_SET_IF_NEW,
OutboundSyncProvider, StaticMapping, sync_all, sync_targets,
)
from pretix.base.datasync.utils import assign_properties
from pretix.base.models import Organizer, Event, Order, Item, OrderPosition
from pretix.base.models import Event, Item, Order, OrderPosition, Organizer
@pytest.fixture(scope='function')
@@ -280,6 +282,7 @@ AssociationMapping = namedtuple('AssociationMapping', (
'via_mapping_pk'
))
class OrderAndTicketAssociationSync(OutboundSyncProvider):
identifier = "example2"
fake_api_client = None
@@ -505,8 +508,8 @@ def test_assign_properties():
[("colors", "red", MODE_APPEND_LIST)], {"colors": "green;blue"}, is_new=False
) == {"colors": "green;blue;red"}
assert assign_properties(
[("colors", "red", MODE_APPEND_LIST)], {"colors": ["green","blue"]}, is_new=False, list_sep=None
[("colors", "red", MODE_APPEND_LIST)], {"colors": ["green", "blue"]}, is_new=False, list_sep=None
) == {"colors": ["green", "blue", "red"]}
assert assign_properties(
[("colors", "green", MODE_APPEND_LIST)], {"colors": ["green","blue"]}, is_new=False, list_sep=None
[("colors", "green", MODE_APPEND_LIST)], {"colors": ["green", "blue"]}, is_new=False, list_sep=None
) == {}