import pytest
from scripts.push_checkouts_to_github import redact_remote


def test_redact_remote_hides_installation_token():
    url = (
        "https://x-access-token:ghs_secret.jwt@github.com/"
        "P2HS/p2hs-296357f807a34085b136e9e2967b8356.git"
    )
    redacted = redact_remote(url)
    assert "ghs_secret" not in redacted
    assert "x-access-token:***" in redacted
    assert "P2HS/p2hs-296357f807a34085b136e9e2967b8356.git" in redacted
