0001-workflows-make-sure-model-filenames-are-unique-14096.patch
tests/test_workflow_import.py | ||
---|---|---|
211 | 211 | |
212 | 212 |
def test_export_to_model_action(): |
213 | 213 |
wf = Workflow(name='status') |
214 |
wf.store() |
|
214 | 215 |
st1 = wf.add_status('Status1', 'st1') |
215 | 216 | |
216 | 217 |
from quixote.http_request import Upload |
... | ... | |
247 | 248 |
wf2 = assert_import_export_works(wf) |
248 | 249 |
assert wf2.possible_status[0].items[0].model_file.get_file().read() == file_content |
249 | 250 | |
251 |
wf2 = assert_import_export_works(wf, include_id=True) |
|
252 |
wf3 = assert_import_export_works(wf2, include_id=True) |
|
253 |
assert wf2.possible_status[0].items[0].model_file.filename == \ |
|
254 |
wf3.possible_status[0].items[0].model_file.filename |
|
255 | ||
256 |
wf3 = assert_import_export_works(wf2, include_id=False) |
|
257 |
assert wf2.possible_status[0].items[0].model_file.filename != \ |
|
258 |
wf3.possible_status[0].items[0].model_file.filename |
|
259 | ||
260 | ||
250 | 261 |
def test_export_roles(): |
251 | 262 |
wf = Workflow(name='roles') |
252 | 263 |
wf.roles = {'foo': 'Bar'} |
wcs/wf/export_to_model.py | ||
---|---|---|
19 | 19 |
from StringIO import StringIO |
20 | 20 |
from xml.etree import ElementTree as ET |
21 | 21 |
import zipfile |
22 |
import random |
|
22 | 23 |
import subprocess |
23 | 24 |
import tempfile |
24 | 25 |
import shutil |
... | ... | |
458 | 459 |
if elem.find('content') is not None: |
459 | 460 |
content = elem.find('content').text |
460 | 461 | |
461 |
ids = (self.parent.parent.id, self.parent.id, self.id) |
|
462 |
if self.parent.parent.id: |
|
463 |
ids = (self.parent.parent.id, self.parent.id, self.id) |
|
464 |
else: |
|
465 |
ids = ('i%i' % random.randint(0, 1000000), self.parent.id, self.id) |
|
462 | 466 |
filename = 'export_to_model-%s-%s-%s.upload' % ids |
463 | 467 | |
464 | 468 |
upload = Upload(base_filename, content_type) |
465 |
- |