You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
378 B
Python

from unittest.mock import MagicMock, patch
from app.app import count_words
@patch("app.app.requests")
def test_count_words(mock_requests):
mock_response = MagicMock()
mock_response.text = "example word count split"
mock_requests.get.return_value = mock_response
wc = count_words("http://anyurl.com")
assert wc == 4
# TODO add test coverage for failure