Завершить аудит и подготовить AI Lead Processor к публикации
This commit is contained in:
1 parent
634490174f
commit
be36989483
14 files changed
+330
-135
No files matched your search
+15
-8
@@ -37,9 +37,12 @@ class StorageTests(unittest.TestCase):
|
||||
def test_parallel_writers_preserve_all_rows(self):
|
||||
ids = [str(uuid4()) for _ in range(6)]
|
||||
with ThreadPoolExecutor(max_workers=4) as executor:
|
||||
results = executor.map(lambda key: storage.append(
|
||||
self.path, {"ID": key, "Текст заявки": "Здравствуйте!"}
|
||||
), ids)
|
||||
results = executor.map(
|
||||
lambda key: storage.append(
|
||||
self.path, {"ID": key, "Текст заявки": "Здравствуйте!"}
|
||||
),
|
||||
ids,
|
||||
)
|
||||
self.assertTrue(all(results))
|
||||
rows, _ = storage.snapshot(self.path)
|
||||
self.assertCountEqual([row["ID"] for row in rows], ids)
|
||||
@@ -63,10 +66,14 @@ class StorageTests(unittest.TestCase):
|
||||
second = {"ID": str(uuid4()), "Текст заявки": "Вторая заявка"}
|
||||
storage.append(self.path, first)
|
||||
original = self.path.read_bytes()
|
||||
with patch("src.storage.os.replace", side_effect=PermissionError):
|
||||
with self.assertRaises(PermissionError):
|
||||
storage.append(self.path, second)
|
||||
with (
|
||||
patch("src.storage.os.replace", side_effect=PermissionError),
|
||||
self.assertRaises(PermissionError),
|
||||
):
|
||||
storage.append(self.path, second)
|
||||
self.assertEqual(self.path.read_bytes(), original)
|
||||
self.assertTrue(storage.append(self.path, second))
|
||||
self.assertEqual([row["ID"] for row in storage.snapshot(self.path)[0]],
|
||||
[first["ID"], second["ID"]])
|
||||
self.assertEqual(
|
||||
[row["ID"] for row in storage.snapshot(self.path)[0]],
|
||||
[first["ID"], second["ID"]],
|
||||
)
|
||||
Reference in new issue
Block a user