mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-01 15:01:18 +00:00
* quick econ fix * black * keys and feature flags * terminal name 👀 * some more replacements * some more replacements * edit pyproject * gst -> openbb * add example portfolios back to git * Update api from gst * sorry. skipping some tests * another round of names * another round of test edits * Missed some .gst refs and update timezone * water mark stuff * Fixing Names in terminal.spec and name of GTFF_DEFAULTS to OBBFF_DEFAULTS * fix more GST to OpenBB Terminal * Logging : merge conflicts with main * Revert wrong files Co-authored-by: Andrew <andrew.kenreich@gmail.com> Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt> Co-authored-by: Chavithra PARANA <chavithra@gmail.com>
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
""" thought_of_the_day.py tests """
|
|
import unittest
|
|
from unittest import mock
|
|
|
|
# pylint: disable=unused-import
|
|
from tests.helpers.tools import ( # noqa: F401
|
|
parameterize_from_file,
|
|
pytest_generate_tests,
|
|
)
|
|
from openbb_terminal import thought_of_the_day
|
|
|
|
assertions = unittest.TestCase("__init__")
|
|
|
|
|
|
class TestThoughtOfTheDay:
|
|
@parameterize_from_file(
|
|
"test_get_urls",
|
|
"../../tests/openbb_terminal/yaml/test_thought_of_the_day/thought_of_the_day.yaml",
|
|
)
|
|
def test_get_urls(self, urls):
|
|
a_totd = thought_of_the_day.ThoughtOfTheDay(urls)
|
|
|
|
assertions.assertEqual(a_totd.get_urls(), urls)
|
|
|
|
@mock.patch("openbb_terminal.thought_of_the_day.requests")
|
|
@parameterize_from_file(
|
|
"test_get_metadata",
|
|
"../../tests/openbb_terminal/yaml/test_thought_of_the_day/thought_of_the_day.yaml",
|
|
)
|
|
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)
|