0001-misc-remove-compatibility-with-old-export-format-685.patch
combo/data/utils.py | ||
---|---|---|
87 | 87 | |
88 | 88 | |
89 | 89 |
def import_site(data, if_empty=False, clean=False, request=None): |
90 |
if isinstance(data, list): |
|
91 |
# old export form with a list of pages, convert it to new dictionary |
|
92 |
# format. |
|
93 |
data = {'pages': data} |
|
94 | ||
95 | 90 |
if 'combo.apps.lingo' in settings.INSTALLED_APPS: |
96 | 91 |
from combo.apps.lingo.models import PaymentBackend, Regie |
97 | 92 |
tests/test_import_export.py | ||
---|---|---|
87 | 87 |
assert Page.objects.count() == 3 |
88 | 88 |
assert TextCell.objects.all().count() == 1 |
89 | 89 | |
90 |
import_site(data=[], clean=True)
|
|
90 |
import_site(data={}, clean=True)
|
|
91 | 91 |
tempdir = tempfile.mkdtemp('chrono-test') |
92 | 92 |
empty_output = get_output_of_command('export_site', output=os.path.join(tempdir, 't.json')) |
93 | 93 |
assert os.path.exists(os.path.join(tempdir, 't.json')) |
... | ... | |
139 | 139 |
assert two.parent.slug == 'two' |
140 | 140 | |
141 | 141 | |
142 |
def test_backward_compatibility_import(app, some_data): |
|
143 |
old_export = Page.export_all_for_json() |
|
144 |
Page.objects.all().delete() |
|
145 |
import_site(data=old_export) |
|
146 |
assert Page.objects.count() == 3 |
|
147 | ||
148 | ||
149 | 142 |
def test_import_export_map_layers(app, some_map_layers): |
150 | 143 |
output = get_output_of_command('export_site') |
151 | 144 |
assert len(json.loads(output)['map-layers']) == 2 |
152 |
- |