tests: adjust to drafts trailing with a slash

This commit is contained in:
Frédéric Péters 2020-02-02 20:01:04 +01:00
parent b94e8196d3
commit 3e91606b06
1 changed files with 6 additions and 9 deletions

View File

@ -99,13 +99,11 @@ def test_myspace_with_user_forms():
assert formdata.id != draft.id
assert '<a href="test/%s/"' % formdata.id in resp
assert '<a href="test/%s"' % draft.id in resp
resp = app.get('/test/%s' % formdata.id)
resp.status_int = 200
resp = app.get('/test/%s' % draft.id, status=302)
resp = app.get('/test/%s/' % formdata.id, status=302)
assert resp.location == 'http://example.net/cat/test/%s/' % formdata.id
resp = app.get('/test/%s/' % draft.id, status=302)
resp = resp.follow(status=302)
resp.location.startswith('http://example.net/test/?mt=')
resp = resp.follow(status=302)
resp.location.startswith('http://example.net/cat/test/?mt=')
assert resp.location.startswith('http://example.net/cat/test/?mt=')
resp = resp.follow(status=200)
# disable formdef: formdatas are still visible and accessible, drafts are not
@ -117,11 +115,10 @@ def test_myspace_with_user_forms():
assert not '<a href="test/%s"' % draft.id in resp
resp = app.get('/cat/test/%s' % formdata.id)
resp.status_int = 200
resp = app.get('/cat/test/%s' % draft.id, status=302)
resp = resp.follow(status=302)
resp.location.startswith('http://example.net/test/?mt=')
resp = app.get('/cat/test/%s/' % draft.id, status=302)
resp = resp.follow(status=403)
def test_form_category_redirection():
Category.wipe()
cat = Category(name='baz')