diff options
| author | A Farzat <a@farzat.xyz> | 2025-10-05 07:24:22 +0300 |
|---|---|---|
| committer | A Farzat <a@farzat.xyz> | 2025-10-05 07:24:22 +0300 |
| commit | 3b418daf684f01a126a56b58c83120af5914f576 (patch) | |
| tree | 20b6ea9487cce5a90cff8696085b8c3f7783db75 /tests/feed.py | |
| parent | 66194a36af3d1f6897e8fd0e3b61388cb18f6e1f (diff) | |
| download | csca5028-3b418daf684f01a126a56b58c83120af5914f576.tar.gz csca5028-3b418daf684f01a126a56b58c83120af5914f576.zip | |
Remove the redundant scheduler class
This allows fetching the database every time, ensuring any updates to
the database between fetches as captured.
Diffstat (limited to 'tests/feed.py')
| -rw-r--r-- | tests/feed.py | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/tests/feed.py b/tests/feed.py index aaeb96a..97a60ef 100644 --- a/tests/feed.py +++ b/tests/feed.py @@ -1,7 +1,6 @@ from typing import Any from mongomock import MongoClient from pymongo.collection import Collection -from schedule import Scheduler from unittest import TestCase from components.subscriptions.main import Subscription from components.subscriptions.typing import SubsDict @@ -12,7 +11,6 @@ class TestFeeds(TestCase): def setUp(self) -> None: self.client: MongoClient[Any] = MongoClient(tz_aware=True) self.collection: Collection[SubsDict] = self.client.db.collection - self.scheduler: Scheduler = Scheduler() def test_insert(self) -> None: sub = Subscription( @@ -21,7 +19,6 @@ class TestFeeds(TestCase): time_between_fetches=5, ) sub._collection = self.collection - sub._scheduler = self.scheduler sub.insert() sub_dict = self.collection.find_one({"_id": "yt:channel:bla"}) self.assertIsNotNone(sub_dict) @@ -35,10 +32,8 @@ class TestFeeds(TestCase): time_between_fetches=1, ) sub._collection = self.collection - sub._scheduler = self.scheduler sub.insert() - sub.initialise_job() - self.scheduler.run_all() + sub.fetch() self.assertEqual(15, len(sub.videos)) sub_dict = self.collection.find_one({"_id": "yt:channel:hlgI3UHCOnwUGzWzbJ3H5w"}) self.assertIsNotNone(sub_dict) @@ -52,12 +47,10 @@ class TestFeeds(TestCase): time_between_fetches=1, ) sub._collection = self.collection - sub._scheduler = self.scheduler sub.insert() - sub.initialise_job() - self.scheduler.run_all() + sub.fetch() sub.link=r"tests/data/feed@ytnnews24@002.xml" - self.scheduler.run_all() + sub.fetch() self.assertEqual(16, len(sub.videos)) sub_dict = self.collection.find_one({"_id": "yt:channel:hlgI3UHCOnwUGzWzbJ3H5w"}) self.assertIsNotNone(sub_dict) |
