Тесты I-2 и M-4 без вывода лога в прогон (#1)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c9fd3d6290
commit
343c49fc2e
@ -80,9 +80,12 @@ class EvaClientTest(unittest.TestCase):
|
||||
self.eva.rpc = lambda m, kw: orig(m, dict(kw, slice=None))
|
||||
for i in range(450):
|
||||
self.eva.add_doc(i + 1, "DOC-%d" % (i + 1), project="P")
|
||||
docs = self.cli.list_docs([["project.code", "==", "P"]], ["id", "code"])
|
||||
out = io.StringIO()
|
||||
with redirect_stdout(out):
|
||||
docs = self.cli.list_docs([["project.code", "==", "P"]], ["id", "code"])
|
||||
self.assertEqual(len(docs), 450)
|
||||
self.assertEqual(len(self.eva.api_calls), 2)
|
||||
self.assertIn("slice не соблюдается", out.getvalue())
|
||||
|
||||
def test_list_slice_ignored_same_page(self):
|
||||
"""M-4: Eva всегда отдаёт первые 200 — без защиты цикл бесконечен."""
|
||||
@ -90,7 +93,8 @@ class EvaClientTest(unittest.TestCase):
|
||||
self.eva.rpc = lambda m, kw: orig(m, dict(kw, slice=[0, 200]))
|
||||
for i in range(450):
|
||||
self.eva.add_doc(i + 1, "DOC-%d" % (i + 1), project="P")
|
||||
docs = self.cli.list_docs([["project.code", "==", "P"]], ["id", "code"])
|
||||
with redirect_stdout(io.StringIO()):
|
||||
docs = self.cli.list_docs([["project.code", "==", "P"]], ["id", "code"])
|
||||
self.assertEqual([d["code"] for d in docs], ["DOC-%d" % (i + 1) for i in range(200)])
|
||||
self.assertEqual(len(self.eva.api_calls), 2)
|
||||
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import hashlib
|
||||
import io
|
||||
import os
|
||||
import unittest
|
||||
from contextlib import redirect_stdout
|
||||
|
||||
from _common import SETTINGS, agent, eva_cfg, no_sleep
|
||||
from fake_eva import FakeEva
|
||||
@ -68,7 +70,7 @@ class WikiFetchTest(unittest.TestCase):
|
||||
enc = "/files/obj/x/%D0%9F%D0%9C%D0%9F%20%D1%84%D0%B0%D0%B9%D0%BB.png"
|
||||
self.eva.add_file(enc, b"png")
|
||||
for path in ("/files/obj/x/ПМП файл.png", enc, "/files/obj/x/ПМП%20файл.png"):
|
||||
with self.subTest(path=path):
|
||||
with self.subTest(path=path), redirect_stdout(io.StringIO()):
|
||||
out = self.fetch(self.file_url(path))
|
||||
self.assertEqual(out["status"], "done", out)
|
||||
self.assertEqual(out["result"]["size"], 3)
|
||||
@ -76,7 +78,8 @@ class WikiFetchTest(unittest.TestCase):
|
||||
|
||||
def test_fetch_stray_percent(self):
|
||||
self.eva.add_file("/files/100%25.txt", b"ok")
|
||||
out = self.fetch(self.file_url("/files/100%.txt"))
|
||||
with redirect_stdout(io.StringIO()):
|
||||
out = self.fetch(self.file_url("/files/100%.txt"))
|
||||
self.assertEqual(out["status"], "done", out)
|
||||
|
||||
def test_value_error_inside_is_not_foreign_host(self):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user