5126 |
5126 |
|
5127 |
5127 |
|
5128 |
5128 |
def test_inspect_page(pub, local_user):
|
|
5129 |
if not pub.is_using_postgresql():
|
|
5130 |
pytest.skip('this requires SQL')
|
|
5131 |
return
|
|
5132 |
|
5129 |
5133 |
create_user(pub)
|
5130 |
5134 |
create_environment(pub)
|
5131 |
5135 |
|
... | ... | |
5282 |
5286 |
assert 'Invalid block tag' in resp.text
|
5283 |
5287 |
|
5284 |
5288 |
|
|
5289 |
def test_inspect_page_with_related_objects(pub):
|
|
5290 |
if not pub.is_using_postgresql():
|
|
5291 |
pytest.skip('this requires SQL')
|
|
5292 |
return
|
|
5293 |
|
|
5294 |
user = create_user(pub, is_admin=True)
|
|
5295 |
|
|
5296 |
formdef1 = FormDef()
|
|
5297 |
formdef1.name = 'form 1'
|
|
5298 |
formdef1.fields = []
|
|
5299 |
formdef1.store()
|
|
5300 |
formdef1.data_class().wipe()
|
|
5301 |
formdata = formdef1.data_class()()
|
|
5302 |
formdata.store()
|
|
5303 |
formdef1.data_class()().store()
|
|
5304 |
|
|
5305 |
formdef2 = FormDef()
|
|
5306 |
formdef2.name = 'form 2'
|
|
5307 |
formdef2.fields = []
|
|
5308 |
formdef2.store()
|
|
5309 |
formdef2.data_class().wipe()
|
|
5310 |
formdef2.data_class()().store()
|
|
5311 |
|
|
5312 |
carddef1 = CardDef()
|
|
5313 |
carddef1.name = 'card 1'
|
|
5314 |
carddef1.fields = []
|
|
5315 |
carddef1.store()
|
|
5316 |
carddef1.data_class().wipe()
|
|
5317 |
carddata = carddef1.data_class()()
|
|
5318 |
carddata.store()
|
|
5319 |
|
|
5320 |
carddef2 = CardDef()
|
|
5321 |
carddef2.name = 'card 2'
|
|
5322 |
carddef2.fields = []
|
|
5323 |
carddef2.backoffice_submission_roles = user.roles
|
|
5324 |
carddef2.store()
|
|
5325 |
carddef2.data_class().wipe()
|
|
5326 |
carddef2.data_class()().store()
|
|
5327 |
|
|
5328 |
related_formdata1 = formdef2.data_class()()
|
|
5329 |
related_formdata1.submission_context = {
|
|
5330 |
'orig_object_type': 'formdef',
|
|
5331 |
'orig_formdata_id': str(formdata.id),
|
|
5332 |
'orig_formdef_id': str(formdef1.id),
|
|
5333 |
}
|
|
5334 |
related_formdata1.store()
|
|
5335 |
related_formdata2 = formdef2.data_class()()
|
|
5336 |
related_formdata2.submission_context = {
|
|
5337 |
'orig_object_type': 'carddef',
|
|
5338 |
'orig_formdata_id': str(carddata.id),
|
|
5339 |
'orig_formdef_id': str(carddef1.id),
|
|
5340 |
}
|
|
5341 |
related_formdata2.store()
|
|
5342 |
|
|
5343 |
related_carddata1 = carddef2.data_class()()
|
|
5344 |
related_carddata1.submission_context = {
|
|
5345 |
'orig_object_type': 'carddef',
|
|
5346 |
'orig_formdata_id': str(carddata.id),
|
|
5347 |
'orig_formdef_id': str(carddef1.id),
|
|
5348 |
}
|
|
5349 |
related_carddata1.store()
|
|
5350 |
related_carddata2 = carddef2.data_class()()
|
|
5351 |
related_carddata2.submission_context = {
|
|
5352 |
'orig_object_type': 'formdef',
|
|
5353 |
'orig_formdata_id': str(formdata.id),
|
|
5354 |
'orig_formdef_id': str(formdef1.id),
|
|
5355 |
}
|
|
5356 |
related_carddata2.store()
|
|
5357 |
|
|
5358 |
assert [f.get_display_id() for f in formdata.get_children()] == [related_formdata1.get_display_id(), related_carddata2.get_display_id()]
|
|
5359 |
assert [c.get_display_id() for c in carddata.get_children()] == [related_formdata2.get_display_id(), related_carddata1.get_display_id()]
|
|
5360 |
|
|
5361 |
app = login(get_app(pub))
|
|
5362 |
resp = app.get('%sinspect' % formdata.get_url(backoffice=True), status=200)
|
|
5363 |
assert 'Related Forms/Cards' in resp.text
|
|
5364 |
assert related_formdata1.get_url(backoffice=True) in resp.text
|
|
5365 |
assert related_carddata2.get_url(backoffice=True) in resp.text
|
|
5366 |
|
|
5367 |
resp = app.get('%sinspect' % carddata.get_url(backoffice=True), status=200)
|
|
5368 |
assert 'Related Forms/Cards' in resp.text
|
|
5369 |
assert related_formdata2.get_url(backoffice=True) in resp.text
|
|
5370 |
assert related_carddata1.get_url(backoffice=True) in resp.text
|
|
5371 |
|
|
5372 |
resp = app.get(related_formdata1.get_url(backoffice=True), status=200)
|
|
5373 |
assert 'Original form' in resp.text
|
|
5374 |
assert '(deleted)' not in resp.text
|
|
5375 |
assert formdata.get_url(backoffice=True) in resp.text
|
|
5376 |
|
|
5377 |
resp = app.get(related_formdata2.get_url(backoffice=True), status=200)
|
|
5378 |
assert 'Original card' in resp.text
|
|
5379 |
assert '(deleted)' not in resp.text
|
|
5380 |
assert carddata.get_url(backoffice=True) in resp.text
|
|
5381 |
|
|
5382 |
resp = app.get(related_carddata1.get_url(backoffice=True), status=200)
|
|
5383 |
assert 'Original card' in resp.text
|
|
5384 |
assert '(deleted)' not in resp.text
|
|
5385 |
assert carddata.get_url(backoffice=True) in resp.text
|
|
5386 |
|
|
5387 |
resp = app.get(related_carddata2.get_url(backoffice=True), status=200)
|
|
5388 |
assert 'Original form' in resp.text
|
|
5389 |
assert '(deleted)' not in resp.text
|
|
5390 |
assert formdata.get_url(backoffice=True) in resp.text
|
|
5391 |
|
|
5392 |
|
5285 |
5393 |
def test_workflow_jump_previous(pub):
|
|
5394 |
if not pub.is_using_postgresql():
|
|
5395 |
pytest.skip('this requires SQL')
|
|
5396 |
return
|
|
5397 |
|
5286 |
5398 |
user = create_user(pub)
|
5287 |
5399 |
create_environment(pub)
|
5288 |
5400 |
|
... | ... | |
6459 |
6571 |
|
6460 |
6572 |
@pytest.fixture(params=[{'attach_to_history': True}, {}])
|
6461 |
6573 |
def create_formdata(request, pub):
|
|
6574 |
if not pub.is_using_postgresql():
|
|
6575 |
pytest.skip('this requires SQL')
|
|
6576 |
return
|
|
6577 |
|
6462 |
6578 |
admin = create_user(pub, is_admin=True)
|
6463 |
6579 |
|
6464 |
6580 |
FormDef.wipe()
|
... | ... | |
6716 |
6832 |
|
6717 |
6833 |
|
6718 |
6834 |
def test_backoffice_create_carddata_from_formdata(pub, studio):
|
|
6835 |
if not pub.is_using_postgresql():
|
|
6836 |
pytest.skip('this requires SQL')
|
|
6837 |
return
|
|
6838 |
|
6719 |
6839 |
CardDef.wipe()
|
6720 |
6840 |
FormDef.wipe()
|
6721 |
6841 |
|