forked from Github-Mirrors/canaille
tests: fix CI
This commit is contained in:
parent
d22766e704
commit
8be771e41d
6 changed files with 25 additions and 31 deletions
|
@ -51,7 +51,7 @@
|
|||
|
||||
{% macro pagination(form) %}
|
||||
<div class="ui right floated buttons pagination">
|
||||
<form id="{{ id }}" action="{{ url_for(request.url_rule.endpoint, **request.view_args) }}" method="POST">
|
||||
<form id="{{ form.__class__.__name__|lower }}" action="{{ url_for(request.url_rule.endpoint, **request.view_args) }}" method="POST">
|
||||
{{ form.hidden_tag() if form.hidden_tag }}
|
||||
<input type="hidden" name="query" value="{{ form.query.data }}">
|
||||
|
||||
|
|
|
@ -20,9 +20,8 @@ def test_group_list_pagination(testclient, logged_admin, foo_group):
|
|||
).text()
|
||||
assert group_name
|
||||
|
||||
form = res.forms["next"]
|
||||
form["page"] = 2
|
||||
res = form.submit()
|
||||
form = res.forms["tableform"]
|
||||
res = form.submit(name="page", value="2")
|
||||
assert group_name not in res.pyquery(
|
||||
".groups tbody tr td:nth-of-type(2) a"
|
||||
).text().split(" ")
|
||||
|
@ -35,13 +34,13 @@ def test_group_list_pagination(testclient, logged_admin, foo_group):
|
|||
|
||||
def test_group_list_bad_pages(testclient, logged_admin):
|
||||
res = testclient.get("/groups")
|
||||
form = res.forms["next"]
|
||||
form = res.forms["tableform"]
|
||||
testclient.post(
|
||||
"/groups", {"csrf_token": form["csrf_token"].value, "page": "2"}, status=404
|
||||
)
|
||||
|
||||
res = testclient.get("/groups")
|
||||
form = res.forms["next"]
|
||||
form = res.forms["tableform"]
|
||||
testclient.post(
|
||||
"/groups", {"csrf_token": form["csrf_token"].value, "page": "-1"}, status=404
|
||||
)
|
||||
|
@ -246,9 +245,8 @@ def test_user_list_pagination(testclient, logged_admin, foo_group):
|
|||
user_name = res.pyquery(".users tbody tr:nth-of-type(1) td:nth-of-type(2) a").text()
|
||||
assert user_name
|
||||
|
||||
form = res.forms["next"]
|
||||
form["page"] = 2
|
||||
res = form.submit()
|
||||
form = res.forms["tableform"]
|
||||
res = form.submit(name="page", value="2")
|
||||
assert user_name not in res.pyquery(".users tr td:nth-of-type(2) a").text().split(
|
||||
" "
|
||||
)
|
||||
|
@ -261,13 +259,13 @@ def test_user_list_pagination(testclient, logged_admin, foo_group):
|
|||
|
||||
def test_user_list_bad_pages(testclient, logged_admin, foo_group):
|
||||
res = testclient.get("/groups/foo")
|
||||
form = res.forms["next"]
|
||||
form = res.forms["tableform"]
|
||||
testclient.post(
|
||||
"/groups/foo", {"csrf_token": form["csrf_token"].value, "page": "2"}, status=404
|
||||
)
|
||||
|
||||
res = testclient.get("/groups/foo")
|
||||
form = res.forms["next"]
|
||||
form = res.forms["tableform"]
|
||||
testclient.post(
|
||||
"/groups/foo",
|
||||
{"csrf_token": form["csrf_token"].value, "page": "-1"},
|
||||
|
|
|
@ -28,9 +28,8 @@ def test_user_list_pagination(testclient, logged_admin):
|
|||
user_name = res.pyquery(".users tbody tr:nth-of-type(1) td:nth-of-type(2) a").text()
|
||||
assert user_name
|
||||
|
||||
form = res.forms["next"]
|
||||
form["page"] = 2
|
||||
res = form.submit()
|
||||
form = res.forms["tableform"]
|
||||
res = form.submit(name="page", value="2")
|
||||
assert user_name not in res.pyquery(
|
||||
".users tbody tr td:nth-of-type(2) a"
|
||||
).text().split(" ")
|
||||
|
@ -43,13 +42,13 @@ def test_user_list_pagination(testclient, logged_admin):
|
|||
|
||||
def test_user_list_bad_pages(testclient, logged_admin):
|
||||
res = testclient.get("/users")
|
||||
form = res.forms["next"]
|
||||
form = res.forms["tableform"]
|
||||
testclient.post(
|
||||
"/users", {"csrf_token": form["csrf_token"].value, "page": "2"}, status=404
|
||||
)
|
||||
|
||||
res = testclient.get("/users")
|
||||
form = res.forms["next"]
|
||||
form = res.forms["tableform"]
|
||||
testclient.post(
|
||||
"/users", {"csrf_token": form["csrf_token"].value, "page": "-1"}, status=404
|
||||
)
|
||||
|
|
|
@ -37,9 +37,8 @@ def test_client_list_pagination(testclient, logged_admin, client, other_client):
|
|||
).text()
|
||||
assert client_name
|
||||
|
||||
form = res.forms["next"]
|
||||
form["page"] = 2
|
||||
res = form.submit()
|
||||
form = res.forms["tableform"]
|
||||
res = form.submit(name="form", value="2")
|
||||
assert client_name not in res.pyquery(
|
||||
".clients tbody tr td:nth-of-type(2) a"
|
||||
).text().split(" ")
|
||||
|
@ -52,7 +51,7 @@ def test_client_list_pagination(testclient, logged_admin, client, other_client):
|
|||
|
||||
def test_client_list_bad_pages(testclient, logged_admin):
|
||||
res = testclient.get("/admin/client")
|
||||
form = res.forms["next"]
|
||||
form = res.forms["tableform"]
|
||||
testclient.post(
|
||||
"/admin/client",
|
||||
{"csrf_token": form["csrf_token"].value, "page": "2"},
|
||||
|
@ -60,7 +59,7 @@ def test_client_list_bad_pages(testclient, logged_admin):
|
|||
)
|
||||
|
||||
res = testclient.get("/admin/client")
|
||||
form = res.forms["next"]
|
||||
form = res.forms["tableform"]
|
||||
testclient.post(
|
||||
"/admin/client",
|
||||
{"csrf_token": form["csrf_token"].value, "page": "-1"},
|
||||
|
|
|
@ -33,9 +33,8 @@ def test_authorization_list_pagination(testclient, logged_admin, client):
|
|||
).text()
|
||||
assert authorization_code_id
|
||||
|
||||
form = res.forms["next"]
|
||||
form["page"] = 2
|
||||
res = form.submit()
|
||||
form = res.forms["tableform"]
|
||||
res = form.submit(name="page", value="2")
|
||||
assert authorization_code_id not in res.pyquery(
|
||||
".codes tbody tr td:nth-of-type(1) a"
|
||||
).text().split(" ")
|
||||
|
@ -48,7 +47,7 @@ def test_authorization_list_pagination(testclient, logged_admin, client):
|
|||
|
||||
def test_authorization_list_bad_pages(testclient, logged_admin):
|
||||
res = testclient.get("/admin/authorization")
|
||||
form = res.forms["next"]
|
||||
form = res.forms["tableform"]
|
||||
testclient.post(
|
||||
"/admin/authorization",
|
||||
{"csrf_token": form["csrf_token"].value, "page": "2"},
|
||||
|
@ -56,7 +55,7 @@ def test_authorization_list_bad_pages(testclient, logged_admin):
|
|||
)
|
||||
|
||||
res = testclient.get("/admin/authorization")
|
||||
form = res.forms["next"]
|
||||
form = res.forms["tableform"]
|
||||
testclient.post(
|
||||
"/admin/authorization",
|
||||
{"csrf_token": form["csrf_token"].value, "page": "-1"},
|
||||
|
|
|
@ -43,9 +43,8 @@ def test_token_list_pagination(testclient, logged_admin, client):
|
|||
token_id = res.pyquery(".tokens tbody tr td:nth-of-type(1) a").text()
|
||||
assert token_id
|
||||
|
||||
form = res.forms["next"]
|
||||
form["page"] = 2
|
||||
res = form.submit()
|
||||
form = res.forms["tableform"]
|
||||
res = form.submit(name="form", value="2")
|
||||
assert token_id not in res.pyquery(
|
||||
".tokens tbody tr:nth-of-type(1) td:nth-of-type(1) a"
|
||||
).text().split(" ")
|
||||
|
@ -58,7 +57,7 @@ def test_token_list_pagination(testclient, logged_admin, client):
|
|||
|
||||
def test_token_list_bad_pages(testclient, logged_admin):
|
||||
res = testclient.get("/admin/token")
|
||||
form = res.forms["next"]
|
||||
form = res.forms["tableform"]
|
||||
testclient.post(
|
||||
"/admin/token",
|
||||
{"csrf_token": form["csrf_token"].value, "page": "2"},
|
||||
|
@ -66,7 +65,7 @@ def test_token_list_bad_pages(testclient, logged_admin):
|
|||
)
|
||||
|
||||
res = testclient.get("/admin/token")
|
||||
form = res.forms["next"]
|
||||
form = res.forms["tableform"]
|
||||
testclient.post(
|
||||
"/admin/token",
|
||||
{"csrf_token": form["csrf_token"].value, "page": "-1"},
|
||||
|
|
Loading…
Reference in a new issue