-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_article_getter.py
More file actions
35 lines (27 loc) · 942 Bytes
/
test_article_getter.py
File metadata and controls
35 lines (27 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""Tests for logic to look up individual article metdata.
License: BSD
"""
import unittest
import article_getter
class ArticleGetterTests(unittest.TestCase):
def test_article_to_dict(self):
article = article_getter.Article(
'test url',
'title original',
'title english',
'2024-01-17',
'us',
['keyword'],
['tags'],
['categories']
)
target_dict = article.to_dict()
self.assertEqual(target_dict['url'], 'test url')
def test_local_handler_all(self):
results = article_getter.local_handler({})
self.assertTrue(len(results) > 0)
self.assertTrue(results[0].get_url() != '')
def test_local_handler_filter(self):
results = article_getter.local_handler({'keyword': 'security'})
self.assertTrue(len(results) > 0)
self.assertTrue(results[0].get_url() != '')