tests: factorize get_table

This commit is contained in:
Benjamin Dauvergne 2018-12-06 21:06:27 +01:00
parent e9a4301542
commit a1d572dbf8
2 changed files with 12 additions and 10 deletions

View File

@ -1,16 +1,7 @@
# -*- coding: utf-8 -*-
from utils import login
from utils import login, get_table
def get_table(response):
table = []
for tr in response.pyquery('table tr'):
row = []
table.append(row)
for td in tr.findall('td'):
row.append(td.text.strip())
return table
def test_simple(schema1, app, admin):
login(app, admin)

View File

@ -18,3 +18,14 @@ def login(app, user, path=None, password=None):
assert str(app.session['_auth_user_id']) == str(user.id)
return response
def get_table(response):
table = []
for tr in response.pyquery('table tr'):
row = []
table.append(row)
for td in tr.findall('td'):
row.append(td.text.strip())
return table