mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix(fastapi): remove trailing slashes from fastapi-driven links
With our FastAPI server, trailing slashes causes a 307 redirect which ends up redirecting users to routes which do not contain trailing slashes. This removes trailing slashes from our templates where FastAPI is concerned to avoid unnecessary redirects. There may still be links or usages around which have unnecessary usages of a trailing slash; please keep a look out for these and remove them where possible. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
e05cfc3375
commit
267f2cb2c4
14 changed files with 58 additions and 58 deletions
|
@ -590,8 +590,8 @@ async def account(request: Request, username: str):
|
||||||
return render_template(request, "account/show.html", context)
|
return render_template(request, "account/show.html", context)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/accounts/")
|
@router.get("/accounts")
|
||||||
@auth_required(True, redirect="/accounts/")
|
@auth_required(True, redirect="/accounts")
|
||||||
@account_type_required({account_type.TRUSTED_USER,
|
@account_type_required({account_type.TRUSTED_USER,
|
||||||
account_type.DEVELOPER,
|
account_type.DEVELOPER,
|
||||||
account_type.TRUSTED_USER_AND_DEV})
|
account_type.TRUSTED_USER_AND_DEV})
|
||||||
|
@ -600,8 +600,8 @@ async def accounts(request: Request):
|
||||||
return render_template(request, "account/search.html", context)
|
return render_template(request, "account/search.html", context)
|
||||||
|
|
||||||
|
|
||||||
@router.post("/accounts/")
|
@router.post("/accounts")
|
||||||
@auth_required(True, redirect="/accounts/")
|
@auth_required(True, redirect="/accounts")
|
||||||
@account_type_required({account_type.TRUSTED_USER,
|
@account_type_required({account_type.TRUSTED_USER,
|
||||||
account_type.DEVELOPER,
|
account_type.DEVELOPER,
|
||||||
account_type.TRUSTED_USER_AND_DEV})
|
account_type.TRUSTED_USER_AND_DEV})
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
{{ "Use this form to search existing accounts." | tr }}
|
{{ "Use this form to search existing accounts." | tr }}
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<form class="account-search-form" action="/accounts/" method="post">
|
<form class="account-search-form" action="/accounts" method="post">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<p>
|
<p>
|
||||||
<label for="id_username">{{ "Username" | tr }}:</label>
|
<label for="id_username">{{ "Username" | tr }}:</label>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<h2>{{ "Submit a proposal to vote on." | tr }}</h2>
|
<h2>{{ "Submit a proposal to vote on." | tr }}</h2>
|
||||||
|
|
||||||
<form action="/addvote/" method="post">
|
<form action="/addvote" method="post">
|
||||||
|
|
||||||
<p class="vote-applicant">
|
<p class="vote-applicant">
|
||||||
<label for="id_user">{{ "Applicant/TU" | tr }}</label>
|
<label for="id_user">{{ "Applicant/TU" | tr }}</label>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<h2>AUR {% trans %}Login{% endtrans %}</h2>
|
<h2>AUR {% trans %}Login{% endtrans %}</h2>
|
||||||
|
|
||||||
{% if request.url.scheme == "http" and config.getboolean("options", "disable_http_login") %}
|
{% if request.url.scheme == "http" and config.getboolean("options", "disable_http_login") %}
|
||||||
{% set https_login = url_base.replace("http://", "https://") + "/login/" %}
|
{% set https_login = url_base.replace("http://", "https://") + "/login" %}
|
||||||
<p>
|
<p>
|
||||||
{{ "HTTP login is disabled. Please %sswitch to HTTPs%s if you want to login."
|
{{ "HTTP login is disabled. Please %sswitch to HTTPs%s if you want to login."
|
||||||
| tr
|
| tr
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
| format("<b>%s</b>" | format(request.user.Username))
|
| format("<b>%s</b>" | format(request.user.Username))
|
||||||
| safe
|
| safe
|
||||||
}}
|
}}
|
||||||
<a href="/logout/?next={{ next }}">[{% trans %}Logout{% endtrans %}]</a>
|
<a href="/logout?next={{ next }}">[{% trans %}Logout{% endtrans %}]</a>
|
||||||
</p>
|
</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
<form method="post" action="/login?next={{ next }}">
|
<form method="post" action="/login?next={{ next }}">
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
<p>
|
<p>
|
||||||
<input class="button" type="submit"
|
<input class="button" type="submit"
|
||||||
value="{% trans %}Login{% endtrans %}">
|
value="{% trans %}Login{% endtrans %}">
|
||||||
<a href="/passreset/">
|
<a href="/passreset">
|
||||||
[{% trans %}Forgot Password{% endtrans %}]
|
[{% trans %}Forgot Password{% endtrans %}]
|
||||||
</a>
|
</a>
|
||||||
<input id="id_referer" type="hidden" name="referer"
|
<input id="id_referer" type="hidden" name="referer"
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<table class="results">
|
<table class="results">
|
||||||
<tr>
|
<tr>
|
||||||
<td align="left">
|
<td align="left">
|
||||||
<form action="/accounts/" method="post">
|
<form action="/accounts" method="post">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<input type="hidden" name="O"
|
<input type="hidden" name="O"
|
||||||
value="{{ offset - pp }}" />
|
value="{{ offset - pp }}" />
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<form action="/accounts/" method="post">
|
<form action="/accounts" method="post">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<input type="hidden" name="O"
|
<input type="hidden" name="O"
|
||||||
value="{{ offset + pp }}" />
|
value="{{ offset + pp }}" />
|
||||||
|
|
|
@ -5,16 +5,16 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
<li><a href="/">AUR {% trans %}Home{% endtrans %}</a></li>
|
<li><a href="/">AUR {% trans %}Home{% endtrans %}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li><a href="/packages/">{% trans %}Packages{% endtrans %}</a></li>
|
<li><a href="/packages">{% trans %}Packages{% endtrans %}</a></li>
|
||||||
{% if request.user.is_authenticated() %}
|
{% if request.user.is_authenticated() %}
|
||||||
<li>
|
<li>
|
||||||
<a href="/requests/">
|
<a href="/requests">
|
||||||
{% trans %}Requests{% endtrans %}
|
{% trans %}Requests{% endtrans %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% if request.user.is_trusted_user() or request.user.is_developer() %}
|
{% if request.user.is_trusted_user() or request.user.is_developer() %}
|
||||||
<li>
|
<li>
|
||||||
<a href="/accounts/">
|
<a href="/accounts">
|
||||||
{% trans %}Accounts{% endtrans %}
|
{% trans %}Accounts{% endtrans %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="/logout/?next={{ next }}">
|
<a href="/logout?next={{ next }}">
|
||||||
{% trans %}Logout{% endtrans %}
|
{% trans %}Logout{% endtrans %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/login/?next={{ next }}">
|
<a href="/login?next={{ next }}">
|
||||||
{% trans %}Login{% endtrans %}
|
{% trans %}Login{% endtrans %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<!-- Alternate resources -->
|
<!-- Alternate resources -->
|
||||||
<link rel="alternate" type="application/rss+xml"
|
<link rel="alternate" type="application/rss+xml"
|
||||||
title="Newest Packages RSS" href="/rss/">
|
title="Newest Packages RSS" href="/rss">
|
||||||
|
|
||||||
<!-- Include local typeahead -->
|
<!-- Include local typeahead -->
|
||||||
<script type="text/javascript" src="/static/js/typeahead.js"></script>
|
<script type="text/javascript" src="/static/js/typeahead.js"></script>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
</li>
|
</li>
|
||||||
{% if not out_of_date %}
|
{% if not out_of_date %}
|
||||||
<li>
|
<li>
|
||||||
<a href="/pkgbase/{{ pkgbase.Name }}/flag/">
|
<a href="/pkgbase/{{ pkgbase.Name }}/flag">
|
||||||
{{ "Flag package out-of-date" | tr }}
|
{{ "Flag package out-of-date" | tr }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -52,14 +52,14 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li>
|
<li>
|
||||||
{% if not voted %}
|
{% if not voted %}
|
||||||
<form action="/pkgbase/{{ pkgbase.Name }}/vote/" method="post">
|
<form action="/pkgbase/{{ pkgbase.Name }}/vote" method="post">
|
||||||
<input type="submit"
|
<input type="submit"
|
||||||
class="button text-button"
|
class="button text-button"
|
||||||
name="do_Vote"
|
name="do_Vote"
|
||||||
value="{{ 'Vote for this package' | tr }}" />
|
value="{{ 'Vote for this package' | tr }}" />
|
||||||
</form>
|
</form>
|
||||||
{% else %}
|
{% else %}
|
||||||
<form action="/pkgbase/{{ pkgbase.Name }}/unvote/" method="post">
|
<form action="/pkgbase/{{ pkgbase.Name }}/unvote" method="post">
|
||||||
<input type="submit"
|
<input type="submit"
|
||||||
class="button text-button"
|
class="button text-button"
|
||||||
name="do_UnVote"
|
name="do_UnVote"
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
{% if notified %}
|
{% if notified %}
|
||||||
<form action="/pkgbase/{{ pkgbase.Name }}/unnotify/" method="post">
|
<form action="/pkgbase/{{ pkgbase.Name }}/unnotify" method="post">
|
||||||
<input type="submit"
|
<input type="submit"
|
||||||
class="button text-button"
|
class="button text-button"
|
||||||
name="do_UnNotify"
|
name="do_UnNotify"
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
/>
|
/>
|
||||||
</form>
|
</form>
|
||||||
{% else %}
|
{% else %}
|
||||||
<form action="/pkgbase/{{ pkgbase.Name }}/notify/" method="post">
|
<form action="/pkgbase/{{ pkgbase.Name }}/notify" method="post">
|
||||||
<input type="submit"
|
<input type="submit"
|
||||||
class="button text-button"
|
class="button text-button"
|
||||||
name="do_Notify"
|
name="do_Notify"
|
||||||
|
@ -88,7 +88,7 @@
|
||||||
</li>
|
</li>
|
||||||
{% if request.user.has_credential('CRED_PKGBASE_EDIT_COMAINTAINERS', approved=[pkgbase.Maintainer]) %}
|
{% if request.user.has_credential('CRED_PKGBASE_EDIT_COMAINTAINERS', approved=[pkgbase.Maintainer]) %}
|
||||||
<li>
|
<li>
|
||||||
<a href="/pkgbase/{{ pkgbase.Name }}/comaintainers/">
|
<a href="/pkgbase/{{ pkgbase.Name }}/comaintainers">
|
||||||
{{ "Manage Co-Maintainers" | tr }}
|
{{ "Manage Co-Maintainers" | tr }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -101,20 +101,20 @@
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li>
|
<li>
|
||||||
<a href="/pkgbase/{{ pkgbase.Name }}/request/">
|
<a href="/pkgbase/{{ pkgbase.Name }}/request">
|
||||||
{{ "Submit Request" | tr }}
|
{{ "Submit Request" | tr }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% if request.user.has_credential("CRED_PKGBASE_DELETE") %}
|
{% if request.user.has_credential("CRED_PKGBASE_DELETE") %}
|
||||||
<li>
|
<li>
|
||||||
<a href="/pkgbase/{{ pkgbase.Name }}/delete/">
|
<a href="/pkgbase/{{ pkgbase.Name }}/delete">
|
||||||
{{ "Delete Package" | tr }}
|
{{ "Delete Package" | tr }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if request.user.has_credential("CRED_PKGBASE_MERGE") %}
|
{% if request.user.has_credential("CRED_PKGBASE_MERGE") %}
|
||||||
<li>
|
<li>
|
||||||
<a href="/pkgbase/{{ pkgbase.Name }}/merge/">
|
<a href="/pkgbase/{{ pkgbase.Name }}/merge">
|
||||||
{{ "Merge Package" | tr }}
|
{{ "Merge Package" | tr }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -130,7 +130,7 @@
|
||||||
</li>
|
</li>
|
||||||
{% elif request.user.has_credential("CRED_PKGBASE_DISOWN", approved=[pkgbase.Maintainer]) %}
|
{% elif request.user.has_credential("CRED_PKGBASE_DISOWN", approved=[pkgbase.Maintainer]) %}
|
||||||
<li>
|
<li>
|
||||||
<a href="/pkgbase/{{ pkgbase.Name }}/disown/">
|
<a href="/pkgbase/{{ pkgbase.Name }}/disown">
|
||||||
{{ "Disown Package" | tr }}
|
{{ "Disown Package" | tr }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
{% if request.user.has_credential("CRED_PKGBASE_SET_KEYWORDS", approved=[pkgbase.Maintainer]) %}
|
{% if request.user.has_credential("CRED_PKGBASE_SET_KEYWORDS", approved=[pkgbase.Maintainer]) %}
|
||||||
<td>
|
<td>
|
||||||
<form method="update"
|
<form method="update"
|
||||||
action="/pkgbase/{{ pkgbase.Name }}/keywords/"
|
action="/pkgbase/{{ pkgbase.Name }}/keywords"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
{% for result in packages %}
|
{% for result in packages %}
|
||||||
<li>
|
<li>
|
||||||
<a href="/packages/{{ result.Name }}/"
|
<a href="/packages/{{ result.Name }}"
|
||||||
title="{{ 'View packages details for' | tr }} {{ result.Name }}">
|
title="{{ 'View packages details for' | tr }} {{ result.Name }}">
|
||||||
{{ result.Name }}
|
{{ result.Name }}
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div id="pkgsearch" class="widget">
|
<div id="pkgsearch" class="widget">
|
||||||
<form id="pkgsearch-form" method="get" action="/packages/">
|
<form id="pkgsearch-form" method="get" action="/packages">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="pkgsearch-field">{{ "Package Search" | tr }}:</label>
|
<label for="pkgsearch-field">{{ "Package Search" | tr }}:</label>
|
||||||
<input type="hidden" name="O" value="0" />
|
<input type="hidden" name="O" value="0" />
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
(<a href="/packages/?SB=l&SO=d">{{ "more" | tr }}</a>)
|
(<a href="/packages/?SB=l&SO=d">{{ "more" | tr }}</a>)
|
||||||
</span>
|
</span>
|
||||||
</h3>
|
</h3>
|
||||||
<a class="rss-icon latest" href="/rss/"
|
<a class="rss-icon latest" href="/rss"
|
||||||
title="AUR Latest Packages RSS Feed">
|
title="AUR Latest Packages RSS Feed">
|
||||||
<img src="/static/images/rss.svg" alt="RSS Feed" />
|
<img src="/static/images/rss.svg" alt="RSS Feed" />
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
{% if title == "Current Votes" %}
|
{% if title == "Current Votes" %}
|
||||||
<ul class="admin-actions">
|
<ul class="admin-actions">
|
||||||
<li>
|
<li>
|
||||||
<a href="/addvote/">
|
<a href="/addvote">
|
||||||
{% trans %}Add Proposal{% endtrans %}
|
{% trans %}Add Proposal{% endtrans %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -942,13 +942,13 @@ def test_get_account_unauthenticated():
|
||||||
|
|
||||||
|
|
||||||
def test_get_accounts(tu_user):
|
def test_get_accounts(tu_user):
|
||||||
""" Test that we can GET request /accounts/ and receive
|
""" Test that we can GET request /accounts and receive
|
||||||
a form which can be used to POST /accounts/. """
|
a form which can be used to POST /accounts. """
|
||||||
sid = user.login(Request(), "testPassword")
|
sid = user.login(Request(), "testPassword")
|
||||||
cookies = {"AURSID": sid}
|
cookies = {"AURSID": sid}
|
||||||
|
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.get("/accounts/", cookies=cookies)
|
response = request.get("/accounts", cookies=cookies)
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
|
|
||||||
parser = lxml.etree.HTMLParser()
|
parser = lxml.etree.HTMLParser()
|
||||||
|
@ -961,7 +961,7 @@ def test_get_accounts(tu_user):
|
||||||
assert len(form) == 1
|
assert len(form) == 1
|
||||||
form = next(iter(form))
|
form = next(iter(form))
|
||||||
assert form.attrib.get("method") == "post"
|
assert form.attrib.get("method") == "post"
|
||||||
assert form.attrib.get("action") == "/accounts/"
|
assert form.attrib.get("action") == "/accounts"
|
||||||
|
|
||||||
def field(element):
|
def field(element):
|
||||||
""" Return the given element string as a valid
|
""" Return the given element string as a valid
|
||||||
|
@ -1020,7 +1020,7 @@ def test_post_accounts(tu_user):
|
||||||
cookies = {"AURSID": sid}
|
cookies = {"AURSID": sid}
|
||||||
|
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies)
|
response = request.post("/accounts", cookies=cookies)
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
|
|
||||||
rows = get_rows(response.text)
|
rows = get_rows(response.text)
|
||||||
|
@ -1061,7 +1061,7 @@ def test_post_accounts_username(tu_user):
|
||||||
cookies = {"AURSID": sid}
|
cookies = {"AURSID": sid}
|
||||||
|
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies,
|
response = request.post("/accounts", cookies=cookies,
|
||||||
data={"U": user.Username})
|
data={"U": user.Username})
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
|
|
||||||
|
@ -1093,14 +1093,14 @@ def test_post_accounts_account_type(tu_user):
|
||||||
|
|
||||||
# Expect no entries; we marked our only user as a User type.
|
# Expect no entries; we marked our only user as a User type.
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies,
|
response = request.post("/accounts", cookies=cookies,
|
||||||
data={"T": "t"})
|
data={"T": "t"})
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
assert len(get_rows(response.text)) == 0
|
assert len(get_rows(response.text)) == 0
|
||||||
|
|
||||||
# So, let's also ensure that specifying "u" returns our user.
|
# So, let's also ensure that specifying "u" returns our user.
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies,
|
response = request.post("/accounts", cookies=cookies,
|
||||||
data={"T": "u"})
|
data={"T": "u"})
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
|
|
||||||
|
@ -1119,7 +1119,7 @@ def test_post_accounts_account_type(tu_user):
|
||||||
).first()
|
).first()
|
||||||
|
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies,
|
response = request.post("/accounts", cookies=cookies,
|
||||||
data={"T": "t"})
|
data={"T": "t"})
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
|
|
||||||
|
@ -1137,7 +1137,7 @@ def test_post_accounts_account_type(tu_user):
|
||||||
).first()
|
).first()
|
||||||
|
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies,
|
response = request.post("/accounts", cookies=cookies,
|
||||||
data={"T": "d"})
|
data={"T": "d"})
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
|
|
||||||
|
@ -1155,7 +1155,7 @@ def test_post_accounts_account_type(tu_user):
|
||||||
).first()
|
).first()
|
||||||
|
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies,
|
response = request.post("/accounts", cookies=cookies,
|
||||||
data={"T": "td"})
|
data={"T": "td"})
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
|
|
||||||
|
@ -1174,7 +1174,7 @@ def test_post_accounts_status(tu_user):
|
||||||
cookies = {"AURSID": sid}
|
cookies = {"AURSID": sid}
|
||||||
|
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies)
|
response = request.post("/accounts", cookies=cookies)
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
|
|
||||||
rows = get_rows(response.text)
|
rows = get_rows(response.text)
|
||||||
|
@ -1188,7 +1188,7 @@ def test_post_accounts_status(tu_user):
|
||||||
user.Suspended = True
|
user.Suspended = True
|
||||||
|
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies,
|
response = request.post("/accounts", cookies=cookies,
|
||||||
data={"S": True})
|
data={"S": True})
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
|
|
||||||
|
@ -1206,7 +1206,7 @@ def test_post_accounts_email(tu_user):
|
||||||
|
|
||||||
# Search via email.
|
# Search via email.
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies,
|
response = request.post("/accounts", cookies=cookies,
|
||||||
data={"E": user.Email})
|
data={"E": user.Email})
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
|
|
||||||
|
@ -1220,7 +1220,7 @@ def test_post_accounts_realname(tu_user):
|
||||||
cookies = {"AURSID": sid}
|
cookies = {"AURSID": sid}
|
||||||
|
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies,
|
response = request.post("/accounts", cookies=cookies,
|
||||||
data={"R": user.RealName})
|
data={"R": user.RealName})
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
|
|
||||||
|
@ -1234,7 +1234,7 @@ def test_post_accounts_irc(tu_user):
|
||||||
cookies = {"AURSID": sid}
|
cookies = {"AURSID": sid}
|
||||||
|
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies,
|
response = request.post("/accounts", cookies=cookies,
|
||||||
data={"I": user.IRCNick})
|
data={"I": user.IRCNick})
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
|
|
||||||
|
@ -1259,14 +1259,14 @@ def test_post_accounts_sortby(tu_user):
|
||||||
|
|
||||||
# Show that "u" is the default search order, by username.
|
# Show that "u" is the default search order, by username.
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies)
|
response = request.post("/accounts", cookies=cookies)
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
rows = get_rows(response.text)
|
rows = get_rows(response.text)
|
||||||
assert len(rows) == 2
|
assert len(rows) == 2
|
||||||
first_rows = rows
|
first_rows = rows
|
||||||
|
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies,
|
response = request.post("/accounts", cookies=cookies,
|
||||||
data={"SB": "u"})
|
data={"SB": "u"})
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
rows = get_rows(response.text)
|
rows = get_rows(response.text)
|
||||||
|
@ -1280,7 +1280,7 @@ def test_post_accounts_sortby(tu_user):
|
||||||
assert compare_text_values(0, first_rows, rows) is True
|
assert compare_text_values(0, first_rows, rows) is True
|
||||||
|
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies,
|
response = request.post("/accounts", cookies=cookies,
|
||||||
data={"SB": "i"})
|
data={"SB": "i"})
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
rows = get_rows(response.text)
|
rows = get_rows(response.text)
|
||||||
|
@ -1291,7 +1291,7 @@ def test_post_accounts_sortby(tu_user):
|
||||||
|
|
||||||
# Sort by "i" -> RealName.
|
# Sort by "i" -> RealName.
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies,
|
response = request.post("/accounts", cookies=cookies,
|
||||||
data={"SB": "r"})
|
data={"SB": "r"})
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
rows = get_rows(response.text)
|
rows = get_rows(response.text)
|
||||||
|
@ -1307,7 +1307,7 @@ def test_post_accounts_sortby(tu_user):
|
||||||
|
|
||||||
# Fetch first_rows again with our new AccountType ordering.
|
# Fetch first_rows again with our new AccountType ordering.
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies)
|
response = request.post("/accounts", cookies=cookies)
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
rows = get_rows(response.text)
|
rows = get_rows(response.text)
|
||||||
assert len(rows) == 2
|
assert len(rows) == 2
|
||||||
|
@ -1315,7 +1315,7 @@ def test_post_accounts_sortby(tu_user):
|
||||||
|
|
||||||
# Sort by "t" -> AccountType.
|
# Sort by "t" -> AccountType.
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies,
|
response = request.post("/accounts", cookies=cookies,
|
||||||
data={"SB": "t"})
|
data={"SB": "t"})
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
rows = get_rows(response.text)
|
rows = get_rows(response.text)
|
||||||
|
@ -1334,7 +1334,7 @@ def test_post_accounts_pgp_key(tu_user):
|
||||||
|
|
||||||
# Search via PGPKey.
|
# Search via PGPKey.
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies,
|
response = request.post("/accounts", cookies=cookies,
|
||||||
data={"K": user.PGPKey})
|
data={"K": user.PGPKey})
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
|
|
||||||
|
@ -1360,7 +1360,7 @@ def test_post_accounts_paged(tu_user):
|
||||||
cookies = {"AURSID": sid}
|
cookies = {"AURSID": sid}
|
||||||
|
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies)
|
response = request.post("/accounts", cookies=cookies)
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
|
|
||||||
rows = get_rows(response.text)
|
rows = get_rows(response.text)
|
||||||
|
@ -1386,7 +1386,7 @@ def test_post_accounts_paged(tu_user):
|
||||||
assert "disabled" not in page_next.attrib
|
assert "disabled" not in page_next.attrib
|
||||||
|
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies,
|
response = request.post("/accounts", cookies=cookies,
|
||||||
data={"O": 50}) # +50 offset.
|
data={"O": 50}) # +50 offset.
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
|
|
||||||
|
@ -1401,7 +1401,7 @@ def test_post_accounts_paged(tu_user):
|
||||||
assert username.text.strip() == _user.Username
|
assert username.text.strip() == _user.Username
|
||||||
|
|
||||||
with client as request:
|
with client as request:
|
||||||
response = request.post("/accounts/", cookies=cookies,
|
response = request.post("/accounts", cookies=cookies,
|
||||||
data={"O": 101}) # Last page.
|
data={"O": 101}) # Last page.
|
||||||
assert response.status_code == int(HTTPStatus.OK)
|
assert response.status_code == int(HTTPStatus.OK)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue