tests: check category export/import as bytes (#36515)
This commit is contained in:
parent
0e120fb4d8
commit
8f3419baf1
|
@ -4,7 +4,7 @@ import shutil
|
|||
|
||||
import pytest
|
||||
|
||||
from django.utils.six import StringIO
|
||||
from django.utils.six import BytesIO
|
||||
from quixote import cleanup
|
||||
from wcs import publisher
|
||||
|
||||
|
@ -73,9 +73,9 @@ def test_xml_export():
|
|||
test.store()
|
||||
test = Category.get(1)
|
||||
|
||||
assert '<name>Test</name>' in test.export_to_xml_string(include_id=True)
|
||||
assert ' id="1"' in test.export_to_xml_string(include_id=True)
|
||||
assert ' id="1"' not in test.export_to_xml_string(include_id=False)
|
||||
assert b'<name>Test</name>' in test.export_to_xml_string(include_id=True)
|
||||
assert b' id="1"' in test.export_to_xml_string(include_id=True)
|
||||
assert b' id="1"' not in test.export_to_xml_string(include_id=False)
|
||||
|
||||
|
||||
def test_xml_import():
|
||||
|
@ -86,7 +86,7 @@ def test_xml_import():
|
|||
test.store()
|
||||
test = Category.get(1)
|
||||
|
||||
fd = StringIO(test.export_to_xml_string(include_id=True))
|
||||
fd = BytesIO(test.export_to_xml_string(include_id=True))
|
||||
test2 = Category.import_from_xml(fd, include_id=True)
|
||||
assert test.id == test2.id
|
||||
assert test.name == test2.name
|
||||
|
|
Loading…
Reference in New Issue