126 |
126 |
Workflow.wipe()
|
127 |
127 |
Category.wipe()
|
128 |
128 |
FormDef.wipe()
|
|
129 |
BlockDef.wipe()
|
129 |
130 |
CardDef.wipe()
|
130 |
131 |
pub.custom_view_class.wipe()
|
131 |
132 |
formdef = FormDef()
|
... | ... | |
136 |
137 |
datasource = {'type': 'formula',
|
137 |
138 |
'value': repr([('A', 'aa'), ('B', 'bb'), ('C', 'cc')])}
|
138 |
139 |
|
|
140 |
formdef.fields = []
|
|
141 |
formdef.store() # make sure sql columns are removed
|
|
142 |
|
139 |
143 |
formdef.fields = [
|
140 |
144 |
fields.StringField(id='1', label='1st field', type='string',
|
141 |
145 |
display_locations=['validation', 'summary', 'listings']),
|
... | ... | |
1472 |
1476 |
assert resp_csv.text.splitlines()[1].split(',')[-1] == 'No'
|
1473 |
1477 |
|
1474 |
1478 |
|
|
1479 |
def test_backoffice_csv_export_block(pub):
|
|
1480 |
create_superuser(pub)
|
|
1481 |
create_environment(pub)
|
|
1482 |
|
|
1483 |
block = BlockDef()
|
|
1484 |
block.name = 'foobar'
|
|
1485 |
block.fields = [
|
|
1486 |
fields.StringField(id='123', required=True, label='Test', type='string', varname='foo'),
|
|
1487 |
fields.StringField(id='234', required=True, label='Test2', type='string', varname='bar'),
|
|
1488 |
]
|
|
1489 |
block.digest_template = 'X{{foobar_var_foo}}Y'
|
|
1490 |
block.store()
|
|
1491 |
|
|
1492 |
formdef = FormDef.get_by_urlname('form-title')
|
|
1493 |
formdef.fields = []
|
|
1494 |
formdef.store() # make sure sql columns are removed
|
|
1495 |
|
|
1496 |
formdef.fields = [
|
|
1497 |
fields.BlockField(id='1', label='test', type='block:foobar', max_items=3),
|
|
1498 |
]
|
|
1499 |
formdef.store()
|
|
1500 |
|
|
1501 |
formdef.data_class().wipe()
|
|
1502 |
formdata = formdef.data_class()()
|
|
1503 |
formdata.data = {}
|
|
1504 |
formdata.data['1'] = {
|
|
1505 |
'data': [
|
|
1506 |
{'123': 'foo', '234': 'bar'},
|
|
1507 |
{'123': 'foo2', '234': 'bar2'},
|
|
1508 |
],
|
|
1509 |
'schema': {'123': 'string', '234': 'string'},
|
|
1510 |
}
|
|
1511 |
formdata.just_created()
|
|
1512 |
formdata.jump_status('new')
|
|
1513 |
formdata.store()
|
|
1514 |
|
|
1515 |
app = login(get_app(pub))
|
|
1516 |
resp = app.get('/backoffice/management/form-title/')
|
|
1517 |
resp_csv = resp.click('Export as CSV File')
|
|
1518 |
resp.forms['listing-settings']['1'].checked = True
|
|
1519 |
resp = resp.forms['listing-settings'].submit()
|
|
1520 |
resp_csv = resp.click('Export as CSV File')
|
|
1521 |
assert resp_csv.text.splitlines()[0].split(',')[-3:] == ['test - 1', 'test - 2', 'test - 3']
|
|
1522 |
assert resp_csv.text.splitlines()[1].split(',')[-3:] == ['XfooY', 'Xfoo2Y', '']
|
|
1523 |
|
|
1524 |
|
1475 |
1525 |
def test_backoffice_ods(pub):
|
1476 |
1526 |
create_superuser(pub)
|
1477 |
1527 |
create_environment(pub)
|
... | ... | |
7142 |
7192 |
card2.data = {'1': 'plop2'}
|
7143 |
7193 |
card2.store()
|
7144 |
7194 |
|
|
7195 |
BlockDef.wipe()
|
7145 |
7196 |
block = BlockDef()
|
7146 |
7197 |
block.name = 'foobar'
|
7147 |
7198 |
block.fields = [
|