aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorA Farzat <a@farzat.xyz>2025-10-05 07:24:22 +0300
committerA Farzat <a@farzat.xyz>2025-10-05 07:24:22 +0300
commit3b418daf684f01a126a56b58c83120af5914f576 (patch)
tree20b6ea9487cce5a90cff8696085b8c3f7783db75 /tests
parent66194a36af3d1f6897e8fd0e3b61388cb18f6e1f (diff)
downloadcsca5028-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')
-rw-r--r--tests/feed.py13
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)