housekeep: TU rename - /tu routes

Change /tu to /package-maintainer

Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
moson 2023-09-10 08:49:59 +02:00
parent f540c79580
commit 148c882501
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
13 changed files with 68 additions and 62 deletions

View file

@ -52,7 +52,7 @@ def populate_package_maintainer_counts(context: dict[str, Any]) -> None:
context["active_package_maintainer_count"] = active_pm_query.count() context["active_package_maintainer_count"] = active_pm_query.count()
@router.get("/tu") @router.get("/package-maintainer")
@requires_auth @requires_auth
async def package_maintainer( async def package_maintainer(
request: Request, request: Request,
@ -141,7 +141,7 @@ async def package_maintainer(
"pby": past_by, "pby": past_by,
} }
return render_template(request, "tu/index.html", context) return render_template(request, "package-maintainer/index.html", context)
def render_proposal( def render_proposal(
@ -176,14 +176,16 @@ def render_proposal(
context["vote"] = vote context["vote"] = vote
context["has_voted"] = vote is not None context["has_voted"] = vote is not None
return render_template(request, "tu/show.html", context, status_code=status_code) return render_template(
request, "package-maintainer/show.html", context, status_code=status_code
)
@router.get("/tu/{proposal}") @router.get("/package-maintainer/{proposal}")
@requires_auth @requires_auth
async def package_maintainer_proposal(request: Request, proposal: int): async def package_maintainer_proposal(request: Request, proposal: int):
if not request.user.has_credential(creds.PM_LIST_VOTES): if not request.user.has_credential(creds.PM_LIST_VOTES):
return RedirectResponse("/tu", status_code=HTTPStatus.SEE_OTHER) return RedirectResponse("/package-maintainer", status_code=HTTPStatus.SEE_OTHER)
context = await make_variable_context(request, "Package Maintainer") context = await make_variable_context(request, "Package Maintainer")
proposal = int(proposal) proposal = int(proposal)
@ -221,14 +223,14 @@ async def package_maintainer_proposal(request: Request, proposal: int):
@db.async_retry_deadlock @db.async_retry_deadlock
@router.post("/tu/{proposal}") @router.post("/package-maintainer/{proposal}")
@handle_form_exceptions @handle_form_exceptions
@requires_auth @requires_auth
async def package_maintainer_proposal_post( async def package_maintainer_proposal_post(
request: Request, proposal: int, decision: str = Form(...) request: Request, proposal: int, decision: str = Form(...)
): ):
if not request.user.has_credential(creds.PM_LIST_VOTES): if not request.user.has_credential(creds.PM_LIST_VOTES):
return RedirectResponse("/tu", status_code=HTTPStatus.SEE_OTHER) return RedirectResponse("/package-maintainer", status_code=HTTPStatus.SEE_OTHER)
context = await make_variable_context(request, "Package Maintainer") context = await make_variable_context(request, "Package Maintainer")
proposal = int(proposal) # Make sure it's an int. proposal = int(proposal) # Make sure it's an int.
@ -292,7 +294,7 @@ async def package_maintainer_addvote(
request: Request, user: str = str(), type: str = "add_pm", agenda: str = str() request: Request, user: str = str(), type: str = "add_pm", agenda: str = str()
): ):
if not request.user.has_credential(creds.PM_ADD_VOTE): if not request.user.has_credential(creds.PM_ADD_VOTE):
return RedirectResponse("/tu", status_code=HTTPStatus.SEE_OTHER) return RedirectResponse("/package-maintainer", status_code=HTTPStatus.SEE_OTHER)
context = await make_variable_context(request, "Add Proposal") context = await make_variable_context(request, "Add Proposal")
@ -318,7 +320,7 @@ async def package_maintainer_addvote_post(
agenda: str = Form(default=str()), agenda: str = Form(default=str()),
): ):
if not request.user.has_credential(creds.PM_ADD_VOTE): if not request.user.has_credential(creds.PM_ADD_VOTE):
return RedirectResponse("/tu", status_code=HTTPStatus.SEE_OTHER) return RedirectResponse("/package-maintainer", status_code=HTTPStatus.SEE_OTHER)
# Build a context. # Build a context.
context = await make_variable_context(request, "Add Proposal") context = await make_variable_context(request, "Add Proposal")
@ -394,5 +396,5 @@ async def package_maintainer_addvote_post(
) )
# Redirect to the new proposal. # Redirect to the new proposal.
endpoint = f"/tu/{voteinfo.ID}" endpoint = f"/package-maintainer/{voteinfo.ID}"
return RedirectResponse(endpoint, status_code=HTTPStatus.SEE_OTHER) return RedirectResponse(endpoint, status_code=HTTPStatus.SEE_OTHER)

View file

@ -780,7 +780,7 @@ class TUVoteReminderNotification(Notification):
).format(id=self._vote_id) ).format(id=self._vote_id)
def get_refs(self): def get_refs(self):
return (aur_location + "/tu/?id=" + str(self._vote_id),) return (aur_location + "/package-maintainer/?id=" + str(self._vote_id),)
def main(): def main():

View file

@ -28,7 +28,7 @@
off = current_off, off = current_off,
by = current_by by = current_by
%} %}
{% include "partials/tu/proposals.html" %} {% include "partials/package-maintainer/proposals.html" %}
{% endwith %} {% endwith %}
{% {%
@ -42,10 +42,10 @@
off = past_off, off = past_off,
by = past_by by = past_by
%} %}
{% include "partials/tu/proposals.html" %} {% include "partials/package-maintainer/proposals.html" %}
{% endwith %} {% endwith %}
{% with title = "Last Votes by Package Maintainer", votes = last_votes_by_pm %} {% with title = "Last Votes by Package Maintainer", votes = last_votes_by_pm %}
{% include "partials/tu/last_votes.html" %} {% include "partials/package-maintainer/last_votes.html" %}
{% endwith %} {% endwith %}
{% endblock %} {% endblock %}

View file

@ -2,12 +2,12 @@
{% block pageContent %} {% block pageContent %}
<div class="box"> <div class="box">
{% include "partials/tu/proposal/details.html" %} {% include "partials/package-maintainer/proposal/details.html" %}
</div> </div>
{% if utcnow >= voteinfo.End %} {% if utcnow >= voteinfo.End %}
<div class="box"> <div class="box">
{% include "partials/tu/proposal/voters.html" %} {% include "partials/package-maintainer/proposal/voters.html" %}
</div> </div>
{% endif %} {% endif %}
@ -15,7 +15,7 @@
{% if error %} {% if error %}
<span class="status">{{ error | tr }}</span> <span class="status">{{ error | tr }}</span>
{% else %} {% else %}
{% include "partials/tu/proposal/form.html" %} {% include "partials/package-maintainer/proposal/form.html" %}
{% endif %} {% endif %}
</div> </div>
{% endblock %} {% endblock %}

View file

@ -39,7 +39,7 @@
{# Only CRED_PM_LIST_VOTES privileged users see Package Maintainer #} {# Only CRED_PM_LIST_VOTES privileged users see Package Maintainer #}
{% if request.user.has_credential(creds.PM_LIST_VOTES) %} {% if request.user.has_credential(creds.PM_LIST_VOTES) %}
<li> <li>
<a href="/tu">{% trans %}Package Maintainer{% endtrans %}</a> <a href="/package-maintainer">{% trans %}Package Maintainer{% endtrans %}</a>
</li> </li>
{% endif %} {% endif %}

View file

@ -24,7 +24,7 @@
</a> </a>
</td> </td>
<td> <td>
<a href="/tu/{{ vote.LastVote }}"> <a href="/package-maintainer/{{ vote.LastVote }}">
{{ vote.LastVote }} {{ vote.LastVote }}
</a> </a>
</td> </td>

View file

@ -1,4 +1,4 @@
<form class="action-form" action="/tu/{{ proposal }}" method="POST"> <form class="action-form" action="/package-maintainer/{{ proposal }}" method="POST">
<!-- Translate each button's text but leave the value alone. --> <!-- Translate each button's text but leave the value alone. -->
<fieldset> <fieldset>
<button type="submit" class="button" name="decision" value="Yes"> <button type="submit" class="button" name="decision" value="Yes">

View file

@ -44,7 +44,7 @@
<td> <td>
<!-- Truncate the agenda back to prev_len. --> <!-- Truncate the agenda back to prev_len. -->
{% set agenda = result.Agenda[:prev_len] %} {% set agenda = result.Agenda[:prev_len] %}
<a href="/tu/{{ result.ID }}">{{ agenda }}</a> <a href="/package-maintainer/{{ result.ID }}">{{ agenda }}</a>
</td> </td>
<td>{{ date_display(result.Submitted) }}</td> <td>{{ date_display(result.Submitted) }}</td>

View file

@ -561,7 +561,7 @@ def test_tu_vote_reminders(user: User):
Please remember to cast your vote on proposal {vote_id} [1]. The voting period Please remember to cast your vote on proposal {vote_id} [1]. The voting period
ends in less than 48 hours. ends in less than 48 hours.
[1] {aur_location}/tu/?id={vote_id}\ [1] {aur_location}/package-maintainer/?id={vote_id}\
""" """
assert email.body == expected assert email.body == expected
@ -586,7 +586,7 @@ def test_notify_main(user: User):
Please remember to cast your vote on proposal {vote_id} [1]. The voting period Please remember to cast your vote on proposal {vote_id} [1]. The voting period
ends in less than 48 hours. ends in less than 48 hours.
[1] {aur_location}/tu/?id={vote_id}\ [1] {aur_location}/package-maintainer/?id={vote_id}\
""" """
assert email.body == expected assert email.body == expected

View file

@ -155,12 +155,12 @@ def proposal(user, tu_user):
def test_tu_index_guest(client): def test_tu_index_guest(client):
headers = {"referer": config.get("options", "aur_location") + "/tu"} headers = {"referer": config.get("options", "aur_location") + "/package-maintainer"}
with client as request: with client as request:
response = request.get("/tu", headers=headers) response = request.get("/package-maintainer", headers=headers)
assert response.status_code == int(HTTPStatus.SEE_OTHER) assert response.status_code == int(HTTPStatus.SEE_OTHER)
params = filters.urlencode({"next": "/tu"}) params = filters.urlencode({"next": "/package-maintainer"})
assert response.headers.get("location") == f"/login?{params}" assert response.headers.get("location") == f"/login?{params}"
@ -169,7 +169,7 @@ def test_tu_index_unauthorized(client: TestClient, user: User):
with client as request: with client as request:
# Login as a normal user, not a TU. # Login as a normal user, not a TU.
request.cookies = cookies request.cookies = cookies
response = request.get("/tu") response = request.get("/package-maintainer")
assert response.status_code == int(HTTPStatus.SEE_OTHER) assert response.status_code == int(HTTPStatus.SEE_OTHER)
assert response.headers.get("location") == "/" assert response.headers.get("location") == "/"
@ -177,11 +177,11 @@ def test_tu_index_unauthorized(client: TestClient, user: User):
def test_tu_empty_index(client, tu_user): def test_tu_empty_index(client, tu_user):
"""Check an empty index when we don't create any records.""" """Check an empty index when we don't create any records."""
# Make a default get request to /tu. # Make a default get request to /package-maintainer.
cookies = {"AURSID": tu_user.login(Request(), "testPassword")} cookies = {"AURSID": tu_user.login(Request(), "testPassword")}
with client as request: with client as request:
request.cookies = cookies request.cookies = cookies
response = request.get("/tu") response = request.get("/package-maintainer")
assert response.status_code == int(HTTPStatus.OK) assert response.status_code == int(HTTPStatus.OK)
# Parse lxml root. # Parse lxml root.
@ -232,13 +232,13 @@ def test_tu_index(client, tu_user):
# Pass an invalid cby and pby; let them default to "desc". # Pass an invalid cby and pby; let them default to "desc".
request.cookies = cookies request.cookies = cookies
response = request.get( response = request.get(
"/tu", "/package-maintainer",
params={"cby": "BAD!", "pby": "blah"}, params={"cby": "BAD!", "pby": "blah"},
) )
assert response.status_code == int(HTTPStatus.OK) assert response.status_code == int(HTTPStatus.OK)
# Rows we expect to exist in HTML produced by /tu for current votes. # Rows we expect to exist in HTML produced by /package-maintainer for current votes.
expected_rows = [ expected_rows = [
( (
r"Test agenda 1", r"Test agenda 1",
@ -265,7 +265,7 @@ def test_tu_index(client, tu_user):
past_votes = [c for c in votes if c[2] <= ts] past_votes = [c for c in votes if c[2] <= ts]
assert len(past_votes) == len(expected_rows) assert len(past_votes) == len(expected_rows)
# Rows we expect to exist in HTML produced by /tu for past votes. # Rows we expect to exist in HTML produced by /package-maintainer for past votes.
expected_rows = [ expected_rows = [
( (
r"Test agenda 2", r"Test agenda 2",
@ -300,7 +300,7 @@ def test_tu_stats(client: TestClient, tu_user: User):
cookies = {"AURSID": tu_user.login(Request(), "testPassword")} cookies = {"AURSID": tu_user.login(Request(), "testPassword")}
with client as request: with client as request:
request.cookies = cookies request.cookies = cookies
response = request.get("/tu") response = request.get("/package-maintainer")
assert response.status_code == HTTPStatus.OK assert response.status_code == HTTPStatus.OK
root = parse_root(response.text) root = parse_root(response.text)
@ -322,7 +322,7 @@ def test_tu_stats(client: TestClient, tu_user: User):
with client as request: with client as request:
request.cookies = cookies request.cookies = cookies
response = request.get("/tu") response = request.get("/package-maintainer")
assert response.status_code == HTTPStatus.OK assert response.status_code == HTTPStatus.OK
root = parse_root(response.text) root = parse_root(response.text)
@ -371,7 +371,7 @@ def test_tu_index_table_paging(client, tu_user):
cookies = {"AURSID": tu_user.login(Request(), "testPassword")} cookies = {"AURSID": tu_user.login(Request(), "testPassword")}
with client as request: with client as request:
request.cookies = cookies request.cookies = cookies
response = request.get("/tu") response = request.get("/package-maintainer")
assert response.status_code == int(HTTPStatus.OK) assert response.status_code == int(HTTPStatus.OK)
# Parse lxml.etree root. # Parse lxml.etree root.
@ -402,7 +402,7 @@ def test_tu_index_table_paging(client, tu_user):
offset = 10 # Specify coff=10 offset = 10 # Specify coff=10
with client as request: with client as request:
request.cookies = cookies request.cookies = cookies
response = request.get("/tu", params={"coff": offset}) response = request.get("package-maintainer", params={"coff": offset})
assert response.status_code == int(HTTPStatus.OK) assert response.status_code == int(HTTPStatus.OK)
old_rows = rows old_rows = rows
@ -430,7 +430,7 @@ def test_tu_index_table_paging(client, tu_user):
offset = 20 # Specify coff=10 offset = 20 # Specify coff=10
with client as request: with client as request:
request.cookies = cookies request.cookies = cookies
response = request.get("/tu", params={"coff": offset}) response = request.get("/package-maintainer", params={"coff": offset})
assert response.status_code == int(HTTPStatus.OK) assert response.status_code == int(HTTPStatus.OK)
# Do it again, we only have five left. # Do it again, we only have five left.
@ -476,11 +476,11 @@ def test_tu_index_sorting(client, tu_user):
# of the tables. # of the tables.
ts += 86405 ts += 86405
# Make a default request to /tu. # Make a default request to /package-maintainer.
cookies = {"AURSID": tu_user.login(Request(), "testPassword")} cookies = {"AURSID": tu_user.login(Request(), "testPassword")}
with client as request: with client as request:
request.cookies = cookies request.cookies = cookies
response = request.get("/tu") response = request.get("/package-maintainer")
assert response.status_code == int(HTTPStatus.OK) assert response.status_code == int(HTTPStatus.OK)
# Get lxml handles of the document. # Get lxml handles of the document.
@ -508,7 +508,7 @@ def test_tu_index_sorting(client, tu_user):
# in ascending order instead of the default descending order. # in ascending order instead of the default descending order.
with client as request: with client as request:
request.cookies = cookies request.cookies = cookies
response = request.get("/tu", params={"cby": "asc"}) response = request.get("/package-maintainer", params={"cby": "asc"})
assert response.status_code == int(HTTPStatus.OK) assert response.status_code == int(HTTPStatus.OK)
# Get lxml handles of the document. # Get lxml handles of the document.
@ -560,7 +560,7 @@ def test_tu_index_last_votes(
cookies = {"AURSID": tu_user.login(Request(), "testPassword")} cookies = {"AURSID": tu_user.login(Request(), "testPassword")}
with client as request: with client as request:
request.cookies = cookies request.cookies = cookies
response = request.get("/tu") response = request.get("/package-maintainer")
assert response.status_code == int(HTTPStatus.OK) assert response.status_code == int(HTTPStatus.OK)
root = parse_root(response.text) root = parse_root(response.text)
@ -583,7 +583,9 @@ def test_tu_proposal_not_found(client, tu_user):
cookies = {"AURSID": tu_user.login(Request(), "testPassword")} cookies = {"AURSID": tu_user.login(Request(), "testPassword")}
with client as request: with client as request:
request.cookies = cookies request.cookies = cookies
response = request.get("/tu", params={"id": 1}, follow_redirects=True) response = request.get(
"/package-maintainer", params={"id": 1}, follow_redirects=True
)
assert response.status_code == int(HTTPStatus.NOT_FOUND) assert response.status_code == int(HTTPStatus.NOT_FOUND)
@ -591,18 +593,18 @@ def test_tu_proposal_unauthorized(
client: TestClient, user: User, proposal: Tuple[User, User, TUVoteInfo] client: TestClient, user: User, proposal: Tuple[User, User, TUVoteInfo]
): ):
cookies = {"AURSID": user.login(Request(), "testPassword")} cookies = {"AURSID": user.login(Request(), "testPassword")}
endpoint = f"/tu/{proposal[2].ID}" endpoint = f"/package-maintainer/{proposal[2].ID}"
with client as request: with client as request:
request.cookies = cookies request.cookies = cookies
response = request.get(endpoint) response = request.get(endpoint)
assert response.status_code == int(HTTPStatus.SEE_OTHER) assert response.status_code == int(HTTPStatus.SEE_OTHER)
assert response.headers.get("location") == "/tu" assert response.headers.get("location") == "/package-maintainer"
with client as request: with client as request:
request.cookies = cookies request.cookies = cookies
response = request.post(endpoint, data={"decision": False}) response = request.post(endpoint, data={"decision": False})
assert response.status_code == int(HTTPStatus.SEE_OTHER) assert response.status_code == int(HTTPStatus.SEE_OTHER)
assert response.headers.get("location") == "/tu" assert response.headers.get("location") == "/package-maintainer"
def test_tu_running_proposal( def test_tu_running_proposal(
@ -612,12 +614,12 @@ def test_tu_running_proposal(
with db.begin(): with db.begin():
voteinfo.ActiveTUs = 1 voteinfo.ActiveTUs = 1
# Initiate an authenticated GET request to /tu/{proposal_id}. # Initiate an authenticated GET request to /package-maintainer/{proposal_id}.
proposal_id = voteinfo.ID proposal_id = voteinfo.ID
cookies = {"AURSID": tu_user.login(Request(), "testPassword")} cookies = {"AURSID": tu_user.login(Request(), "testPassword")}
with client as request: with client as request:
request.cookies = cookies request.cookies = cookies
response = request.get(f"/tu/{proposal_id}") response = request.get(f"/package-maintainer/{proposal_id}")
assert response.status_code == int(HTTPStatus.OK) assert response.status_code == int(HTTPStatus.OK)
# Alright, now let's continue on to verifying some markup. # Alright, now let's continue on to verifying some markup.
@ -688,7 +690,9 @@ def test_tu_running_proposal(
# Make another request now that we've voted. # Make another request now that we've voted.
with client as request: with client as request:
request.cookies = cookies request.cookies = cookies
response = request.get("/tu", params={"id": voteinfo.ID}, follow_redirects=True) response = request.get(
"/package-maintainer", params={"id": voteinfo.ID}, follow_redirects=True
)
assert response.status_code == int(HTTPStatus.OK) assert response.status_code == int(HTTPStatus.OK)
# Parse our new root. # Parse our new root.
@ -710,12 +714,12 @@ def test_tu_ended_proposal(client, proposal):
with db.begin(): with db.begin():
voteinfo.End = ts - 5 # 5 seconds ago. voteinfo.End = ts - 5 # 5 seconds ago.
# Initiate an authenticated GET request to /tu/{proposal_id}. # Initiate an authenticated GET request to /package-maintainer/{proposal_id}.
proposal_id = voteinfo.ID proposal_id = voteinfo.ID
cookies = {"AURSID": tu_user.login(Request(), "testPassword")} cookies = {"AURSID": tu_user.login(Request(), "testPassword")}
with client as request: with client as request:
request.cookies = cookies request.cookies = cookies
response = request.get(f"/tu/{proposal_id}") response = request.get(f"/package-maintainer/{proposal_id}")
assert response.status_code == int(HTTPStatus.OK) assert response.status_code == int(HTTPStatus.OK)
# Alright, now let's continue on to verifying some markup. # Alright, now let's continue on to verifying some markup.
@ -748,7 +752,7 @@ def test_tu_proposal_vote_not_found(client, tu_user):
with client as request: with client as request:
data = {"decision": "Yes"} data = {"decision": "Yes"}
request.cookies = cookies request.cookies = cookies
response = request.post("/tu/1", data=data) response = request.post("/package-maintainer/1", data=data)
assert response.status_code == int(HTTPStatus.NOT_FOUND) assert response.status_code == int(HTTPStatus.NOT_FOUND)
@ -762,7 +766,7 @@ def test_tu_proposal_vote(client, proposal):
with client as request: with client as request:
data = {"decision": "Yes"} data = {"decision": "Yes"}
request.cookies = cookies request.cookies = cookies
response = request.post(f"/tu/{voteinfo.ID}", data=data) response = request.post(f"/package-maintainer/{voteinfo.ID}", data=data)
assert response.status_code == int(HTTPStatus.OK) assert response.status_code == int(HTTPStatus.OK)
# Check that the proposal record got updated. # Check that the proposal record got updated.
@ -791,7 +795,7 @@ def test_tu_proposal_vote_unauthorized(
with client as request: with client as request:
data = {"decision": "Yes"} data = {"decision": "Yes"}
request.cookies = cookies request.cookies = cookies
response = request.post(f"/tu/{voteinfo.ID}", data=data) response = request.post(f"package-maintainer/{voteinfo.ID}", data=data)
assert response.status_code == int(HTTPStatus.UNAUTHORIZED) assert response.status_code == int(HTTPStatus.UNAUTHORIZED)
root = parse_root(response.text) root = parse_root(response.text)
@ -801,7 +805,7 @@ def test_tu_proposal_vote_unauthorized(
with client as request: with client as request:
data = {"decision": "Yes"} data = {"decision": "Yes"}
request.cookies = cookies request.cookies = cookies
response = request.get(f"/tu/{voteinfo.ID}", params=data) response = request.get(f"/package-maintainer/{voteinfo.ID}", params=data)
assert response.status_code == int(HTTPStatus.OK) assert response.status_code == int(HTTPStatus.OK)
root = parse_root(response.text) root = parse_root(response.text)
@ -820,7 +824,7 @@ def test_tu_proposal_vote_cant_self_vote(client, proposal):
with client as request: with client as request:
data = {"decision": "Yes"} data = {"decision": "Yes"}
request.cookies = cookies request.cookies = cookies
response = request.post(f"/tu/{voteinfo.ID}", data=data) response = request.post(f"/package-maintainer/{voteinfo.ID}", data=data)
assert response.status_code == int(HTTPStatus.BAD_REQUEST) assert response.status_code == int(HTTPStatus.BAD_REQUEST)
root = parse_root(response.text) root = parse_root(response.text)
@ -830,7 +834,7 @@ def test_tu_proposal_vote_cant_self_vote(client, proposal):
with client as request: with client as request:
data = {"decision": "Yes"} data = {"decision": "Yes"}
request.cookies = cookies request.cookies = cookies
response = request.get(f"/tu/{voteinfo.ID}", params=data) response = request.get(f"/package-maintainer/{voteinfo.ID}", params=data)
assert response.status_code == int(HTTPStatus.OK) assert response.status_code == int(HTTPStatus.OK)
root = parse_root(response.text) root = parse_root(response.text)
@ -850,7 +854,7 @@ def test_tu_proposal_vote_already_voted(client, proposal):
with client as request: with client as request:
data = {"decision": "Yes"} data = {"decision": "Yes"}
request.cookies = cookies request.cookies = cookies
response = request.post(f"/tu/{voteinfo.ID}", data=data) response = request.post(f"/package-maintainer/{voteinfo.ID}", data=data)
assert response.status_code == int(HTTPStatus.BAD_REQUEST) assert response.status_code == int(HTTPStatus.BAD_REQUEST)
root = parse_root(response.text) root = parse_root(response.text)
@ -860,7 +864,7 @@ def test_tu_proposal_vote_already_voted(client, proposal):
with client as request: with client as request:
data = {"decision": "Yes"} data = {"decision": "Yes"}
request.cookies = cookies request.cookies = cookies
response = request.get(f"/tu/{voteinfo.ID}", params=data) response = request.get(f"/package-maintainer/{voteinfo.ID}", params=data)
assert response.status_code == int(HTTPStatus.OK) assert response.status_code == int(HTTPStatus.OK)
root = parse_root(response.text) root = parse_root(response.text)
@ -875,7 +879,7 @@ def test_tu_proposal_vote_invalid_decision(client, proposal):
with client as request: with client as request:
data = {"decision": "EVIL"} data = {"decision": "EVIL"}
request.cookies = cookies request.cookies = cookies
response = request.post(f"/tu/{voteinfo.ID}", data=data) response = request.post(f"package-maintainer/{voteinfo.ID}", data=data)
assert response.status_code == int(HTTPStatus.BAD_REQUEST) assert response.status_code == int(HTTPStatus.BAD_REQUEST)
assert response.text == "Invalid 'decision' value." assert response.text == "Invalid 'decision' value."
@ -896,13 +900,13 @@ def test_tu_addvote_unauthorized(
request.cookies = cookies request.cookies = cookies
response = request.get("/addvote") response = request.get("/addvote")
assert response.status_code == int(HTTPStatus.SEE_OTHER) assert response.status_code == int(HTTPStatus.SEE_OTHER)
assert response.headers.get("location") == "/tu" assert response.headers.get("location") == "/package-maintainer"
with client as request: with client as request:
request.cookies = cookies request.cookies = cookies
response = request.post("/addvote") response = request.post("/addvote")
assert response.status_code == int(HTTPStatus.SEE_OTHER) assert response.status_code == int(HTTPStatus.SEE_OTHER)
assert response.headers.get("location") == "/tu" assert response.headers.get("location") == "/package-maintainer"
def test_tu_addvote_invalid_type(client: TestClient, tu_user: User): def test_tu_addvote_invalid_type(client: TestClient, tu_user: User):

View file

@ -40,7 +40,7 @@ def email_pieces(voteinfo: TUVoteInfo) -> Tuple[str, str]:
content = ( content = (
f"Please remember to cast your vote on proposal {voteinfo.ID} " f"Please remember to cast your vote on proposal {voteinfo.ID} "
f"[1]. The voting period\nends in less than 48 hours.\n\n" f"[1]. The voting period\nends in less than 48 hours.\n\n"
f"[1] {aur_location}/tu/?id={voteinfo.ID}" f"[1] {aur_location}/package-maintainer/?id={voteinfo.ID}"
) )
return subject, content return subject, content