Prevents time-slot relay and schedule auto-fill from colliding with URLs already used for manual/featured pushes; UI sits beside full-channel fill. Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
985 B
Python
31 lines
985 B
Python
# -*- coding: utf-8 -*-
|
|
"""Tests for timeslot exclude list parse/dedupe."""
|
|
from __future__ import annotations
|
|
|
|
from app.yt_assign_db import parse_timeslot_exclude_text
|
|
|
|
|
|
def test_parse_timeslot_exclude_dedupes_and_normalizes():
|
|
text = """
|
|
https://live.douyin.com/111111111111,主播: A,
|
|
https://live.douyin.com/111111111111
|
|
222222222222
|
|
https://live.douyin.com/222222222222?foo=1
|
|
not-a-url
|
|
https://live.douyin.com/333333333333,主播: B,
|
|
"""
|
|
r = parse_timeslot_exclude_text(text)
|
|
assert r["ok"] is True
|
|
assert r["count"] == 3
|
|
assert r["skipped_dup"] >= 2
|
|
assert r["skipped_invalid"] >= 1
|
|
ids = {it["room_id"] for it in r["items"]}
|
|
assert ids == {"111111111111", "222222222222", "333333333333"}
|
|
assert all(it["url"].startswith("https://live.douyin.com/") for it in r["items"])
|
|
|
|
|
|
def test_parse_timeslot_exclude_empty():
|
|
r = parse_timeslot_exclude_text(" \n ")
|
|
assert r["count"] == 0
|
|
assert r["items"] == []
|