Initial commit: RIPE CIDR/FQDN collector
Collector daemon, FastAPI server (addresses, diff, collect, sources), SQLite storage with change journal, Docker Compose deployment, tests, documentation and project rules. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
commit
bcf8156085
45 files changed
+3134
No files matched your search
@@ -0,0 +1,80 @@
|
||||
import datetime
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
import api_server
|
||||
import cidr_collector as cc
|
||||
import db
|
||||
from storage import StorageError, load_json
|
||||
|
||||
NOW = datetime.datetime.now()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def files(tmp_path, monkeypatch):
|
||||
monkeypatch.setattr(cc, "CONFIG_FILE", str(tmp_path / "config.json"))
|
||||
monkeypatch.setattr(cc, "DATA_FILE", str(tmp_path / "data.json"))
|
||||
monkeypatch.setattr(cc, "FQDN_DATA_FILE", str(tmp_path / "fqdn_data.json"))
|
||||
monkeypatch.setattr(cc, "DB_FILE", str(tmp_path / "ripe.db"))
|
||||
return tmp_path
|
||||
|
||||
|
||||
def stored(kind="asn"):
|
||||
with db.session() as conn:
|
||||
return sorted(db.get_values(conn, kind))
|
||||
|
||||
|
||||
def test_ttl_merge_and_failure_safety(files, monkeypatch):
|
||||
(files / "config.json").write_text('{"asns": [1], "ttl_days": 90}')
|
||||
collector = cc.CIDRCollector()
|
||||
old = (NOW - datetime.timedelta(days=100)).isoformat(timespec="seconds")
|
||||
with db.session() as conn:
|
||||
conn.execute("INSERT INTO addresses VALUES ('asn', '1', '9.9.9.0/24', ?, ?)", (old, old))
|
||||
|
||||
# Ошибка источника: ничего не удаляется, даже просроченное
|
||||
monkeypatch.setattr(collector, "fetch_prefixes", lambda asn: None)
|
||||
collector.run_collection()
|
||||
assert stored() == ["9.9.9.0/24"]
|
||||
|
||||
# Успешный ответ: просроченный удаляется, новый добавляется
|
||||
monkeypatch.setattr(collector, "fetch_prefixes", lambda asn: ["1.1.1.0/24"])
|
||||
collector.run_collection()
|
||||
assert stored() == ["1.1.1.0/24"]
|
||||
|
||||
|
||||
def test_corrupted_storage_is_preserved(files):
|
||||
# Битый JSON (конфигурация)
|
||||
path = files / "data.json"
|
||||
path.write_text("{broken")
|
||||
with pytest.raises(StorageError):
|
||||
load_json(str(path), {})
|
||||
assert not path.exists()
|
||||
assert len(list(files.glob("data.json.corrupt-*"))) == 1
|
||||
|
||||
# Битая база: убирается в сторону, ошибка отдаётся как StorageError
|
||||
(files / "ripe.db").write_bytes(b"this is not a sqlite database" * 100)
|
||||
with pytest.raises(StorageError):
|
||||
db.connect()
|
||||
assert not (files / "ripe.db").exists()
|
||||
assert len(list(files.glob("ripe.db.corrupt-*"))) == 1
|
||||
|
||||
|
||||
def test_post_schedule_auth(files, monkeypatch):
|
||||
(files / "config.json").write_text('{"asns": [], "fqdns": []}')
|
||||
client = TestClient(api_server.app)
|
||||
body = {"type": "asn", "cron": "*/5 * * * *"}
|
||||
|
||||
monkeypatch.delenv("RIPE_API_TOKEN", raising=False)
|
||||
assert client.post("/schedule", json=body).status_code == 503
|
||||
|
||||
monkeypatch.setenv("RIPE_API_TOKEN", "secret")
|
||||
assert client.post("/schedule", json=body).status_code == 401
|
||||
assert client.post("/schedule", json=body, headers={"X-API-Key": "wrong"}).status_code == 401
|
||||
assert client.post("/schedule", json=body, headers={"X-API-Key": "secret"}).status_code == 200
|
||||
assert load_json(cc.CONFIG_FILE, {})["schedule"]["asn"] == "*/5 * * * *"
|
||||
assert client.get("/addresses").status_code == 200
|
||||
@@ -0,0 +1,97 @@
|
||||
import datetime
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
import api_server
|
||||
import cidr_collector as cc
|
||||
import collector_daemon as daemon
|
||||
from storage import load_json, save_json_atomic
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def env(tmp_path, monkeypatch):
|
||||
for attr, name in (("CONFIG_FILE", "config.json"), ("DATA_FILE", "data.json"),
|
||||
("FQDN_DATA_FILE", "fqdn_data.json"), ("STATUS_FILE", "status.json"),
|
||||
("DB_FILE", "ripe.db"), ("COLLECT_REQUEST_FILE", "collect_request.json")):
|
||||
monkeypatch.setattr(cc, attr, str(tmp_path / name))
|
||||
monkeypatch.setattr(daemon, "job_state", {name: {"cron": None, "last_run": None, "last_finished": None,
|
||||
"running": False, "last_error": None,
|
||||
"rejected_cron": None} for name in daemon.COLLECTORS})
|
||||
return tmp_path
|
||||
|
||||
|
||||
def test_sync_schedule_reschedules_and_ignores_invalid_cron(env):
|
||||
save_json_atomic(cc.CONFIG_FILE, {"schedule": {"asn": "0 1 * * *", "fqdn": "0 3 * * *"}})
|
||||
scheduler = daemon.build_scheduler()
|
||||
assert daemon.job_state["asn"]["cron"] == "0 1 * * *"
|
||||
|
||||
save_json_atomic(cc.CONFIG_FILE, {"schedule": {"asn": "*/5 * * * *", "fqdn": "0 3 * * *"}})
|
||||
daemon.sync_schedule(scheduler)
|
||||
assert daemon.job_state["asn"]["cron"] == "*/5 * * * *"
|
||||
assert "*/5" in str(scheduler.get_job("asn_job").trigger)
|
||||
|
||||
# Невалидный cron не ломает действующее расписание
|
||||
save_json_atomic(cc.CONFIG_FILE, {"schedule": {"asn": "not a cron", "fqdn": "0 3 * * *"}})
|
||||
daemon.sync_schedule(scheduler)
|
||||
assert daemon.job_state["asn"]["cron"] == "*/5 * * * *"
|
||||
# Каждая сверка пишет heartbeat
|
||||
assert load_json(cc.STATUS_FILE, None)["jobs"]["asn"]["cron"] == "*/5 * * * *"
|
||||
|
||||
|
||||
def test_health_reflects_collector_heartbeat(env):
|
||||
client = TestClient(api_server.app)
|
||||
|
||||
# Демон не запускался
|
||||
body = client.get("/health").json()
|
||||
assert body["collector_alive"] is False and body["status"] == "degraded"
|
||||
|
||||
now = datetime.datetime.now()
|
||||
save_json_atomic(cc.STATUS_FILE, {"updated_at": now.isoformat(), "jobs": {}})
|
||||
body = client.get("/health").json()
|
||||
assert body["collector_alive"] is True and body["status"] == "ok"
|
||||
|
||||
stale = now - datetime.timedelta(seconds=cc.STATUS_STALE_AFTER + 60)
|
||||
save_json_atomic(cc.STATUS_FILE, {"updated_at": stale.isoformat(), "jobs": {}})
|
||||
body = client.get("/health").json()
|
||||
assert body["collector_alive"] is False and body["status"] == "degraded"
|
||||
|
||||
|
||||
def test_collect_request_api(env, monkeypatch):
|
||||
monkeypatch.setenv("RIPE_API_TOKEN", "secret")
|
||||
client = TestClient(api_server.app)
|
||||
key = {"X-API-Key": "secret"}
|
||||
|
||||
assert client.post("/collect").status_code == 401
|
||||
# Демон не запущен: запрос не ставится в очередь
|
||||
assert client.post("/collect", headers=key).status_code == 503
|
||||
assert not os.path.exists(cc.COLLECT_REQUEST_FILE)
|
||||
|
||||
save_json_atomic(cc.STATUS_FILE, {"updated_at": datetime.datetime.now().isoformat(), "jobs": {}})
|
||||
assert client.post("/collect", json={"type": "asn"}, headers=key).json()["requested"] == ["asn"]
|
||||
# Повторные запросы объединяются; без тела - все типы
|
||||
assert client.post("/collect", headers=key).json()["requested"] == ["asn", "fqdn"]
|
||||
assert client.post("/collect", json={"type": "bad"}, headers=key).status_code == 422
|
||||
assert load_json(cc.COLLECT_REQUEST_FILE, {})["types"] == ["asn", "fqdn"]
|
||||
|
||||
|
||||
def test_daemon_runs_requested_collection_once(env, monkeypatch):
|
||||
scheduler = daemon.build_scheduler()
|
||||
cc.request_collection(["asn"])
|
||||
|
||||
daemon.check_collect_requests(scheduler)
|
||||
assert scheduler.get_job("asn_manual") is not None and scheduler.get_job("fqdn_manual") is None
|
||||
assert not os.path.exists(cc.COLLECT_REQUEST_FILE) # запрос забран
|
||||
daemon.check_collect_requests(scheduler) # повторный вызов ничего не делает
|
||||
|
||||
# Пока сбор этого типа идёт, второй запуск пропускается
|
||||
monkeypatch.setitem(daemon.COLLECTORS, "asn", lambda: pytest.fail("collection must be skipped"))
|
||||
daemon._run_locks["asn"].acquire()
|
||||
try:
|
||||
daemon.run_job("asn", scheduler)
|
||||
finally:
|
||||
daemon._run_locks["asn"].release()
|
||||
@@ -0,0 +1,78 @@
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
import cidr_collector as cc
|
||||
import db
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def files(tmp_path, monkeypatch):
|
||||
for attr, name in (("DB_FILE", "ripe.db"), ("DATA_FILE", "data.json"), ("FQDN_DATA_FILE", "fqdn_data.json")):
|
||||
monkeypatch.setattr(cc, attr, str(tmp_path / name))
|
||||
return tmp_path
|
||||
|
||||
|
||||
def test_legacy_json_import(files):
|
||||
before = datetime.datetime.now().isoformat(timespec="seconds")
|
||||
(files / "data.json").write_text(json.dumps({
|
||||
# Новый формат: first_seen/last_seen сохраняются
|
||||
"1": {"last_updated": "2026-02-01T00:00:00", "prefixes": ["1.0.0.0/24"],
|
||||
"seen": {"1.0.0.0/24": {"first_seen": "2026-01-01T00:00:00", "last_seen": "2026-02-01T00:00:00"}}},
|
||||
# Старый формат без seen: first_seen = last_updated, last_seen = момент миграции
|
||||
"2": {"last_updated": "2025-12-01T00:00:00", "prefixes": ["2.0.0.0/24"]}}))
|
||||
(files / "fqdn_data.json").write_text(json.dumps(
|
||||
{"example.com": {"last_updated": "2025-12-01T00:00:00", "ips": ["9.9.9.9"]}}))
|
||||
|
||||
with db.session() as conn:
|
||||
rows = {(k, s, v): (f, l) for k, s, v, f, l in conn.execute("SELECT * FROM addresses")}
|
||||
assert rows[("asn", "1", "1.0.0.0/24")] == ("2026-01-01T00:00:00", "2026-02-01T00:00:00")
|
||||
first, last = rows[("asn", "2", "2.0.0.0/24")]
|
||||
assert first == "2025-12-01T00:00:00" and last >= before
|
||||
assert ("fqdn", "example.com", "9.9.9.9") in rows
|
||||
|
||||
# Оригиналы переименованы (резервная копия), повторное открытие ничего не импортирует
|
||||
assert not (files / "data.json").exists() and len(list(files.glob("data.json.migrated-*"))) == 1
|
||||
(files / "data.json").write_text(json.dumps({"3": {"prefixes": ["3.0.0.0/24"]}}))
|
||||
with db.session() as conn:
|
||||
assert db.count_values(conn) == 3
|
||||
|
||||
|
||||
def test_change_journal(files):
|
||||
now = datetime.datetime.now()
|
||||
(files / "data.json").write_text(json.dumps({"9": {"prefixes": ["9.0.0.0/24"]}}))
|
||||
with db.session() as conn:
|
||||
# Импорт из JSON в журнал не попадает
|
||||
assert db.get_changes(conn, {"asn"}, cursor=0) == (set(), set(), 0)
|
||||
|
||||
with db.transaction(conn):
|
||||
db.merge_source(conn, "asn", "1", {"a", "b"}, now, 90)
|
||||
db.merge_source(conn, "asn", "2", {"b"}, now, 90)
|
||||
added, removed, c1 = db.get_changes(conn, {"asn"}, cursor=0)
|
||||
assert (added, removed) == ({"a", "b"}, set())
|
||||
|
||||
# Значение b держит второй источник: исчезает только a
|
||||
with db.transaction(conn):
|
||||
db.purge_source(conn, "asn", "1")
|
||||
assert db.get_changes(conn, {"asn"}, cursor=c1)[:2] == (set(), {"a"})
|
||||
|
||||
# Удалено и возвращено в одном интервале - изменений нет; повтор с новым курсором пуст
|
||||
c2 = db.get_changes(conn, {"asn"}, cursor=c1)[2]
|
||||
with db.transaction(conn):
|
||||
db.purge_source(conn, "asn", "2")
|
||||
db.merge_source(conn, "asn", "2", {"b"}, now, 90)
|
||||
added, removed, c3 = db.get_changes(conn, {"asn"}, cursor=c2)
|
||||
assert (added, removed) == (set(), set()) and c3 > c2
|
||||
assert db.get_changes(conn, {"fqdn"}, cursor=0)[:2] == (set(), set()) # фильтр по типу
|
||||
|
||||
# Очистка сдвигает горизонт: старый курсор недействителен, текущий - нет; курсор «из будущего» тоже
|
||||
with db.transaction(conn):
|
||||
assert db.prune_changes(conn, now + datetime.timedelta(days=2), 1) > 0
|
||||
assert db.get_changes(conn, {"asn"}, cursor=0) is None
|
||||
assert db.get_changes(conn, {"asn"}, cursor=c3 + 1) is None
|
||||
assert db.get_changes(conn, {"asn"}, cursor=c3) == (set(), set(), c3)
|
||||
@@ -0,0 +1,54 @@
|
||||
import datetime
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
import api_server
|
||||
import cidr_collector as cc
|
||||
import db
|
||||
import formatters
|
||||
|
||||
VALUES = ["10.0.0.0/23", "10.0.0.0/24", "10.0.1.5", "2001:db8::/32", "1.1.1.1"]
|
||||
|
||||
|
||||
def test_select_default_aggregate_and_version():
|
||||
# По умолчанию вывод прежний: строки как есть, лексикографическая сортировка
|
||||
assert formatters.build_output(VALUES) == sorted(VALUES)
|
||||
assert formatters.build_output(VALUES, ip_version="6") == ["2001:db8::/32"]
|
||||
assert "2001:db8::/32" not in formatters.build_output(VALUES, ip_version="4")
|
||||
# Агрегация: /24 и 10.0.1.5 поглощены /23, одиночный IP печатается без /32
|
||||
assert formatters.build_output(VALUES, aggregate=True) == ["1.1.1.1", "10.0.0.0/23", "2001:db8::/32"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("fmt,v4_line,v6_line", [
|
||||
("nftables", "add element inet ripe ripe_v4 {", "add element inet ripe ripe_v6 {"),
|
||||
("mikrotik", "/ip firewall address-list add list=ripe address=10.0.0.0/23",
|
||||
"/ipv6 firewall address-list add list=ripe address=2001:db8::/32"),
|
||||
("bird", "define RIPE_V4 = [", "define RIPE_V6 = ["),
|
||||
("frr", "ip prefix-list ripe_v4 seq 10 permit 10.0.0.0/23", "ipv6 prefix-list ripe_v6 seq 5 permit 2001:db8::/32"),
|
||||
])
|
||||
def test_render_formats(fmt, v4_line, v6_line):
|
||||
out = formatters.build_output(VALUES, fmt, aggregate=True)
|
||||
assert v4_line in out and v6_line in out and out.endswith("\n")
|
||||
# Пустая версия пропускается
|
||||
only_v6 = formatters.build_output(VALUES, fmt, ip_version="6")
|
||||
assert v6_line in only_v6 and v4_line not in only_v6
|
||||
|
||||
|
||||
def test_api_formats(tmp_path, monkeypatch):
|
||||
monkeypatch.setattr(cc, "DB_FILE", str(tmp_path / "ripe.db"))
|
||||
monkeypatch.setattr(cc, "DATA_FILE", str(tmp_path / "data.json"))
|
||||
monkeypatch.setattr(cc, "FQDN_DATA_FILE", str(tmp_path / "fqdn_data.json"))
|
||||
with db.session() as conn, db.transaction(conn):
|
||||
db.merge_source(conn, "asn", "1", {"10.0.0.0/23", "2001:db8::/32"}, datetime.datetime.now(), 90)
|
||||
client = TestClient(api_server.app)
|
||||
|
||||
assert client.get("/addresses").json() == ["10.0.0.0/23", "2001:db8::/32"]
|
||||
resp = client.get("/addresses", params={"format": "mikrotik", "name": "tg"})
|
||||
assert resp.headers["content-type"].startswith("text/plain")
|
||||
assert "list=tg address=10.0.0.0/23" in resp.text
|
||||
assert client.get("/addresses", params={"name": "bad name;"}).status_code == 422
|
||||
@@ -0,0 +1,97 @@
|
||||
import datetime
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
import api_server
|
||||
import cidr_collector as cc
|
||||
import db
|
||||
from storage import load_json, save_json_atomic
|
||||
|
||||
KEY = {"X-API-Key": "secret"}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def env(tmp_path, monkeypatch):
|
||||
monkeypatch.setattr(cc, "CONFIG_FILE", str(tmp_path / "config.json"))
|
||||
monkeypatch.setattr(cc, "DATA_FILE", str(tmp_path / "data.json"))
|
||||
monkeypatch.setattr(cc, "FQDN_DATA_FILE", str(tmp_path / "fqdn_data.json"))
|
||||
monkeypatch.setattr(cc, "DB_FILE", str(tmp_path / "ripe.db"))
|
||||
monkeypatch.setenv("RIPE_API_TOKEN", "secret")
|
||||
save_json_atomic(cc.CONFIG_FILE, {"asns": [], "fqdns": [], "ttl_days": 90})
|
||||
return TestClient(api_server.app)
|
||||
|
||||
|
||||
def test_manage_asns_and_fqdns(env):
|
||||
# Без ключа - 401; ASN добавляется один раз (201, затем 200)
|
||||
assert env.post("/asns", json={"asn": 62041}).status_code == 401
|
||||
assert env.post("/asns", json={"asn": 62041}, headers=KEY).status_code == 201
|
||||
assert env.post("/asns", json={"asn": 62041}, headers=KEY).status_code == 200
|
||||
assert env.get("/asns").json() == {"asns": [62041]}
|
||||
assert env.post("/asns", json={"asn": 0}, headers=KEY).status_code == 422
|
||||
|
||||
# FQDN нормализуется; IP-литералы и неверные метки отклоняются
|
||||
resp = env.post("/fqdns", json={"fqdn": " Example.COM. "}, headers=KEY)
|
||||
assert resp.status_code == 201 and resp.json()["fqdn"] == "example.com"
|
||||
for bad in ("1.2.3.4", "bad_name.com", "-a.com", "a..com"):
|
||||
assert env.post("/fqdns", json={"fqdn": bad}, headers=KEY).status_code == 422
|
||||
assert env.get("/fqdns").json() == {"fqdns": ["example.com"]}
|
||||
|
||||
# Удаление: 404 для неизвестного, 200 для существующего, конфиг обновлён
|
||||
assert env.delete("/asns/1", headers=KEY).status_code == 404
|
||||
assert env.delete("/fqdns/example.com", headers=KEY).status_code == 200
|
||||
assert env.delete("/asns/62041", headers=KEY).status_code == 200
|
||||
assert load_json(cc.CONFIG_FILE, {})["asns"] == [] and load_json(cc.CONFIG_FILE, {})["fqdns"] == []
|
||||
|
||||
|
||||
def sources():
|
||||
with db.session() as conn:
|
||||
return {s for (s,) in conn.execute("SELECT DISTINCT source FROM addresses")}
|
||||
|
||||
|
||||
def test_removed_source_data_purge_and_ttl(env, monkeypatch):
|
||||
now = datetime.datetime.now()
|
||||
with db.session() as conn:
|
||||
for source, days_ago in (("1", 1), ("2", 100), ("3", 1)):
|
||||
stamp = (now - datetime.timedelta(days=days_ago)).isoformat(timespec="seconds")
|
||||
conn.execute("INSERT INTO addresses VALUES ('asn', ?, '10.0.0.0/24', ?, ?)", (source, stamp, stamp))
|
||||
save_json_atomic(cc.CONFIG_FILE, {"asns": [1, 2, 3], "ttl_days": 90})
|
||||
|
||||
# Без purge данные остаются, purge=true удаляет сразу
|
||||
assert env.delete("/asns/2", headers=KEY).status_code == 200
|
||||
assert env.delete("/asns/3?purge=true", headers=KEY).json() == {"asn": 3, "removed": True, "purged": True}
|
||||
assert sources() == {"1", "2"}
|
||||
|
||||
# Сбор: у неопрашиваемого источника 2 адрес просрочен (100 > 90 дней) - исчезает
|
||||
collector = cc.CIDRCollector()
|
||||
monkeypatch.setattr(collector, "fetch_prefixes", lambda asn: ["10.0.0.0/24"])
|
||||
collector.run_collection()
|
||||
assert sources() == {"1"}
|
||||
|
||||
|
||||
def test_addresses_diff(env):
|
||||
now = datetime.datetime.now()
|
||||
with db.session() as conn, db.transaction(conn):
|
||||
db.merge_source(conn, "asn", "1", {"1.0.0.0/24", "2001:db8::/32"}, now, 90)
|
||||
db.merge_source(conn, "fqdn", "example.com", {"9.9.9.9"}, now, 90)
|
||||
horizon = dict(conn.execute("SELECT key, value FROM meta"))["horizon_ts"]
|
||||
|
||||
body = env.get("/addresses/diff", params={"since": "0"}).json()
|
||||
assert body["added"] == ["1.0.0.0/24", "2001:db8::/32", "9.9.9.9"] and body["removed"] == []
|
||||
assert env.get("/addresses/diff", params={"since": "0", "type": "cidr", "ip_version": "6"}).json()["added"] == [
|
||||
"2001:db8::/32"]
|
||||
assert env.get("/addresses").headers["X-Changes-Cursor"] == str(body["cursor"])
|
||||
assert env.get("/addresses", params={"format": "nftables"}).headers["X-Changes-Cursor"] == str(body["cursor"])
|
||||
# Время вместо курсора; с полученным курсором изменений нет
|
||||
assert env.get("/addresses/diff", params={"since": horizon}).json()["added"] == body["added"]
|
||||
assert env.get("/addresses/diff", params={"since": body["cursor"]}).json()["added"] == []
|
||||
|
||||
# Неверное значение - 400; вне журнала (курсор из будущего, время до создания журнала) - 410
|
||||
assert env.get("/addresses/diff", params={"since": "yesterday"}).status_code == 400
|
||||
assert env.get("/addresses/diff", params={"since": body["cursor"] + 1}).status_code == 410
|
||||
assert env.get("/addresses/diff", params={"since": "2000-01-01T00:00:00Z"}).status_code == 410
|
||||
assert env.get("/addresses/diff").status_code == 422
|
||||
Reference in new issue
Block a user