test: cover Filed withdrawal authorization
This commit is contained in:
parent
6a03dfd7ac
commit
e64541463c
|
|
@ -202,6 +202,33 @@ async def test_completed_filed_issue_remains_authorized_for_detail_and_reply():
|
|||
assert authorized is True
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
("state", "author", "authorized"),
|
||||
[("open", "timmy", True), ("closed", "timmy", False), ("open", "alex", False)],
|
||||
)
|
||||
async def test_only_open_authored_issues_are_authorized_for_withdrawal(
|
||||
state, author, authorized
|
||||
):
|
||||
async def upstream(request):
|
||||
if request.url.path.endswith("/user"):
|
||||
return httpx.Response(200, json={"login": "timmy"})
|
||||
return httpx.Response(200, json={
|
||||
"state": state,
|
||||
"user": {"login": author},
|
||||
})
|
||||
|
||||
gitea_proxy.start_client(transport=httpx.MockTransport(upstream))
|
||||
try:
|
||||
result = await gitea_proxy.is_open_authored_issue(
|
||||
"stackchain/dashboard", 89
|
||||
)
|
||||
finally:
|
||||
await gitea_proxy.stop_client()
|
||||
|
||||
assert result is authorized
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_resolve_work_route_rejects_a_notification_that_is_already_read():
|
||||
async def upstream(request):
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user