Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HurinHu committed May 9, 2021
1 parent 3522585 commit 5767a26
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,34 +53,39 @@ def testResultContainsKeyword(self):
googlenews = GoogleNews()
googlenews.search(keyword)
result = googlenews.result()[0]
print(result.get('desc').lower())
self.assertIn(keyword.lower(), result.get('desc').lower())
print('Result contains keyword')

def testResultHasLink(self):
googlenews = GoogleNews()
googlenews.search(keyword)
result = googlenews.result()[0]
print(result.get('link').lower())
self.assertIn('http', result.get('link').lower())
print('Result contains http link')

def testResultHasImage(self):
googlenews = GoogleNews()
googlenews.search(keyword)
result = googlenews.result()[0]
print(result.get('img').lower())
self.assertIn('base64', result.get('img').lower())
print('Result contains image')

def testResultHasTitle(self):
googlenews = GoogleNews()
googlenews.search(keyword)
result = googlenews.result()[0]
print(result.get('title').lower())
self.assertIsNot('', result.get('title').lower())
print('Result title is not empty')

def testResultHasMedia(self):
googlenews = GoogleNews()
googlenews.search(keyword)
result = googlenews.result()[0]
print(result.get('media').lower())
self.assertIsNot('', result.get('media').lower())
print('Result media is not empty')

Expand Down

0 comments on commit 5767a26

Please sign in to comment.