22 |
22 |
import mock
|
23 |
23 |
|
24 |
24 |
from quixote import cleanup, get_publisher
|
|
25 |
from quixote.http_request import Upload as QuixoteUpload
|
|
26 |
|
25 |
27 |
from wcs.qommon import errors, sessions
|
|
28 |
from wcs.qommon.form import UploadedFile
|
26 |
29 |
from qommon.ident.password_accounts import PasswordAccount
|
27 |
30 |
from wcs.qommon.http_request import HTTPRequest
|
28 |
31 |
from wcs.qommon.template import get_current_theme
|
... | ... | |
3736 |
3739 |
formdef = FormDef()
|
3737 |
3740 |
formdef.name = 'foo'
|
3738 |
3741 |
formdef.store()
|
3739 |
|
Workflow(name='bar').store()
|
3740 |
3742 |
Category(name='baz').store()
|
3741 |
3743 |
Role(name='qux').store()
|
3742 |
3744 |
NamedDataSource(name='quux').store()
|
3743 |
3745 |
NamedWsCall(name='corge').store()
|
3744 |
3746 |
|
|
3747 |
wf = Workflow(name='bar')
|
|
3748 |
st1 = wf.add_status('Status1', 'st1')
|
|
3749 |
export_to = ExportToModel()
|
|
3750 |
export_to.label = 'test'
|
|
3751 |
upload = QuixoteUpload('/foo/bar', content_type='application/vnd.oasis.opendocument.text')
|
|
3752 |
file_content = '''PK\x03\x04\x14\x00\x00\x08\x00\x00\'l\x8eG^\xc62\x0c\'\x00'''
|
|
3753 |
upload.fp = StringIO.StringIO()
|
|
3754 |
upload.fp.write(file_content)
|
|
3755 |
upload.fp.seek(0)
|
|
3756 |
export_to.model_file = UploadedFile('models', 'export_to_model-1.upload', upload)
|
|
3757 |
st1.items.append(export_to)
|
|
3758 |
export_to.parent = st1
|
|
3759 |
wf.store()
|
|
3760 |
|
3745 |
3761 |
resp = app.get('/backoffice/settings/export')
|
3746 |
3762 |
resp = resp.form.submit('submit')
|
3747 |
3763 |
zip_content = StringIO.StringIO(resp.body)
|
... | ... | |
3749 |
3765 |
filelist = zipf.namelist()
|
3750 |
3766 |
assert 'formdefs/1' in filelist
|
3751 |
3767 |
assert 'workflows/1' in filelist
|
|
3768 |
assert 'models/export_to_model-1.upload' in filelist
|
3752 |
3769 |
assert 'roles/1' in filelist
|
3753 |
3770 |
assert 'categories/1' in filelist
|
3754 |
3771 |
assert 'datasources/1' in filelist
|
... | ... | |
3783 |
3800 |
filelist = zipf.namelist()
|
3784 |
3801 |
assert 'formdefs/1' in filelist
|
3785 |
3802 |
assert 'workflows/1' in filelist
|
|
3803 |
assert 'models/export_to_model-1.upload' in filelist
|
3786 |
3804 |
assert 'roles/1' not in filelist
|
3787 |
3805 |
assert 'categories/1' in filelist
|
3788 |
3806 |
assert 'datasources/1' in filelist
|