summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
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)