# retoor <retoor@molodetz.nl>

from tests.conftest import BASE_URL


def test_devii_adopt_redirects(page, app_server):
    resp = page.request.get(
        f"{BASE_URL}/devii/adopt?next=/feed", max_redirects=0
    )
    assert resp.status == 303
    assert resp.headers.get("location") == "/feed"


def test_devii_adopt_rejects_external(page, app_server):
    resp = page.request.get(
        f"{BASE_URL}/devii/adopt?next=https://evil.com", max_redirects=0
    )
    assert resp.status == 303
    assert resp.headers.get("location") == "/"
