def test_get_urls(self): urls = { "some author": "https://www.goodreads.com/author/quotes/someauthor" } a_totd = thought_of_the_day.ThoughtOfTheDay(urls) self.assertEqual(a_totd.get_urls(), urls)
def test_get_metadata(self, mock_request_get, urls, mock_goodreads_page, expected_result): mock_request_get.get().text = mock_goodreads_page a_totd = thought_of_the_day.ThoughtOfTheDay(urls) meta = a_totd.get_metadata(list(urls.keys())[0]) assertions.assertEqual(meta, expected_result)
def test_get_metadata(self, mock_request_get): urls = { "some author": "https://www.goodreads.com/author/quotes/someauthor" } mock_request_get.get().text = mock_goodreads_page a_totd = thought_of_the_day.ThoughtOfTheDay(urls) meta = a_totd.get_metadata("some author") self.assertEqual( meta, { "pages": "6", "quoutes": "171", "quotes": [ "\n “Do not spoil what you have”\n ―\n \n Epicurus\n \n" ], }, )
def test_get_urls(self, urls): a_totd = thought_of_the_day.ThoughtOfTheDay(urls) assertions.assertEqual(a_totd.get_urls(), urls)