Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions app/templates/bounty_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ <h1>{{ bounty.title }}</h1>
<h2 id="acceptance-heading">What has to be true</h2>
<p>{{ bounty.acceptance }}</p>
</section>

<section class="acceptance-card" aria-labelledby="contributor-links-heading">
<p class="eyebrow">Contributor links</p>
<h2 id="contributor-links-heading">Inspect this bounty</h2>
<ul>
<li><a href="/api/v1/bounties/{{ bounty.id }}">Bounty JSON</a></li>
<li><a href="/api/v1/bounties/{{ bounty.id }}/attempts">Active attempts JSON</a></li>
<li><a href="/api/v1/bounties/{{ bounty.id }}/attempts?include_expired=true">All attempts JSON</a></li>
{% if issue_url %}
<li><a href="{{ issue_url }}">Source issue</a></li>
{% endif %}
</ul>
</section>
</section>

<section>
Expand Down
35 changes: 35 additions & 0 deletions tests/test_bounty_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from app.db import create_schema, session_scope
from app.ledger.service import close_bounty, create_bounty, ensure_genesis, pay_bounty
from app.main import create_app
from app.models import Bounty


def test_bounties_page_renders_and_filters_by_status(sqlite_url: str) -> None:
Expand Down Expand Up @@ -295,6 +296,11 @@ def test_bounty_detail_highlights_action_fields(sqlite_url: str) -> None:
assert "<span>Issue</span>" in response.text
assert "100 MRWK" in response.text
assert "What has to be true" in response.text
assert "Inspect this bounty" in response.text
assert f'href="/api/v1/bounties/{bounty.id}"' in response.text
assert f'href="/api/v1/bounties/{bounty.id}/attempts"' in response.text
assert f'href="/api/v1/bounties/{bounty.id}/attempts?include_expired=true"' in response.text
assert 'href="https://github.com/ramimbo/mergework/issues/4"' in response.text
assert "Focused PR improves status, reward, issue link, and acceptance text." in response.text

missing_response = client.get("/api/v1/bounties/999")
Expand All @@ -310,6 +316,35 @@ def test_bounty_detail_highlights_action_fields(sqlite_url: str) -> None:
assert oversized_page_response.status_code == 400


def test_bounty_detail_omits_source_issue_when_url_is_missing(sqlite_url: str) -> None:
create_schema(sqlite_url)
with session_scope(sqlite_url) as session:
ensure_genesis(session)
bounty = Bounty(
repo="ramimbo/mergework",
issue_number=5,
issue_url="",
title="Bounty without an external issue",
reward_microunits=50_000_000,
reserved_microunits=50_000_000,
acceptance="This bounty has no external issue link.",
)
session.add(bounty)
session.flush()
bounty_id = bounty.id

client = TestClient(create_app(database_url=sqlite_url, webhook_secret="secret"))

response = client.get(f"/bounties/{bounty_id}")

assert response.status_code == 200
assert "Inspect this bounty" in response.text
assert f'href="/api/v1/bounties/{bounty_id}"' in response.text
assert f'href="/api/v1/bounties/{bounty_id}/attempts"' in response.text
assert f'href="/api/v1/bounties/{bounty_id}/attempts?include_expired=true"' in response.text
assert "Source issue" not in response.text
Comment thread
coderabbitai[bot] marked this conversation as resolved.


def test_bounty_detail_shows_accepted_award_history(sqlite_url: str) -> None:
create_schema(sqlite_url)
with session_scope(sqlite_url) as session:
Expand Down
Loading