tests: get formdata id dynamically as they're not reset to one in sql
This commit is contained in:
parent
ebdede76f7
commit
ac8770e7ae
|
@ -130,7 +130,8 @@ def test_form_string_field_submit(pub):
|
|||
next_page = next_page.follow()
|
||||
assert 'The form has been recorded' in next_page.body
|
||||
assert formdef.data_class().count() == 1
|
||||
data = formdef.data_class().get(1)
|
||||
data_id = formdef.data_class().select()[0].id
|
||||
data = formdef.data_class().get(data_id)
|
||||
assert data.data == {'0': 'foobar'}
|
||||
|
||||
def test_form_multi_page(pub):
|
||||
|
@ -154,7 +155,8 @@ def test_form_multi_page(pub):
|
|||
next_page = next_page.follow()
|
||||
assert 'The form has been recorded' in next_page.body
|
||||
assert formdef.data_class().count() == 1
|
||||
data = formdef.data_class().get(1)
|
||||
data_id = formdef.data_class().select()[0].id
|
||||
data = formdef.data_class().get(data_id)
|
||||
assert data.data == {'1': 'foo', '3': 'bar'}
|
||||
|
||||
def test_form_multi_page_condition(pub):
|
||||
|
@ -271,6 +273,7 @@ def test_form_tracking_code(pub):
|
|||
assert formdef.data_class().select()[0].is_draft()
|
||||
assert formdef.data_class().select()[0].tracking_code == tracking_code
|
||||
assert formdef.data_class().select()[0].data['0'] == 'foobar'
|
||||
formdata_id = formdef.data_class().select()[0].id
|
||||
|
||||
# check we can load the formdata as a draft
|
||||
resp = get_app(pub).get('/')
|
||||
|
@ -278,7 +281,7 @@ def test_form_tracking_code(pub):
|
|||
resp = resp.forms[0].submit()
|
||||
assert resp.location == 'http://example.net/code/%s/load' % tracking_code
|
||||
resp = resp.follow()
|
||||
assert resp.location == 'http://example.net/test/1'
|
||||
assert resp.location == 'http://example.net/test/%s' % formdata_id
|
||||
resp = resp.follow()
|
||||
assert resp.location.startswith('http://example.net/test/?mt=')
|
||||
resp = resp.follow()
|
||||
|
@ -339,6 +342,7 @@ def test_form_tracking_code_as_user(pub):
|
|||
assert formdef.data_class().select()[0].is_draft()
|
||||
assert formdef.data_class().select()[0].tracking_code == tracking_code
|
||||
assert formdef.data_class().select()[0].data['0'] == 'foobar'
|
||||
formdata_id = formdef.data_class().select()[0].id
|
||||
|
||||
# check we can load the formdata as a draft
|
||||
resp = login(get_app(pub), username='foo', password='foo').get('/')
|
||||
|
@ -346,7 +350,7 @@ def test_form_tracking_code_as_user(pub):
|
|||
resp = resp.forms[0].submit()
|
||||
assert resp.location == 'http://example.net/code/%s/load' % tracking_code
|
||||
resp = resp.follow()
|
||||
assert resp.location == 'http://example.net/test/1'
|
||||
assert resp.location == 'http://example.net/test/%s' % formdata_id
|
||||
resp = resp.follow()
|
||||
assert resp.location.startswith('http://example.net/test/?mt=')
|
||||
resp = resp.follow()
|
||||
|
|
Loading…
Reference in New Issue