Projet

Général

Profil

0001-backoffice-go-to-return-url-after-removal-of-draft-4.patch

Frédéric Péters, 13 octobre 2020 09:29

Télécharger (1,91 ko)

Voir les différences:

Subject: [PATCH] backoffice: go to "return url" after removal of draft
 (#47598)

 tests/test_backoffice_pages.py | 11 +++++++++++
 wcs/backoffice/submission.py   |  4 +++-
 2 files changed, 14 insertions(+), 1 deletion(-)
tests/test_backoffice_pages.py
2668 2668
    resp = resp.form.submit('submit')  # -> to submit
2669 2669
    assert resp.location == 'https://example.org'
2670 2670

  
2671
    # test removal of draft
2672
    resp = app.get('/backoffice/submission/form-title/?ReturnURL=https://example.org')
2673
    resp = resp.follow().follow()
2674
    resp.form['f1'] = 'test submission'
2675
    resp.form['f2'] = 'baz'
2676
    resp.form['f3'] = 'C'
2677
    resp = resp.form.submit('submit')  # -> to validation
2678
    resp = resp.click('Delete this form')
2679
    resp = resp.form.submit('delete')
2680
    assert resp.location == 'https://example.org'
2681

  
2671 2682

  
2672 2683
def test_backoffice_parallel_submission(pub):
2673 2684
    user = create_user(pub)
wcs/backoffice/submission.py
71 71

  
72 72
        if formdata.tracking_code:
73 73
            get_publisher().tracking_code_class.remove_object(formdata.tracking_code)
74
        if formdata.submission_context:
75
            return_url = formdata.submission_context.get('return_url')
74 76
        formdata.remove_self()
75
        return redirect('../..')
77
        return redirect(return_url or '../..')
76 78

  
77 79

  
78 80
class SubmissionFormStatusPage(FormStatusPage):
79
-