"""Regression: a retried promotion must be able to overwrite its rollback backup ref. A
non-forced push was rejected as non-fast-forward on every retry, so production never promoted."""

from src.workers.repo_ops import backup_push_args


def test_backup_push_is_forced_so_retries_can_update_the_ref():
    args = backup_push_args("refs/p2hs/backups/b3b079e3")
    assert args == ("push", "--force", "origin", "refs/p2hs/backups/b3b079e3:refs/p2hs/backups/b3b079e3")


def test_backup_push_only_targets_the_backup_namespace():
    args = backup_push_args("refs/p2hs/backups/abc")
    assert all(not a.startswith("refs/heads") for a in args)
