Created
January 5, 2017 17:02
-
-
Save tuannvm/fcdcfb75fa56b9a5356a21a2ed42e1e9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Standard library imports... | |
from unittest.mock import Mock, patch | |
# Third-party imports... | |
from nose.tools import assert_is_not_none | |
# Local imports... | |
from project.services import get_todos | |
@patch('project.services.requests.get') | |
def test_getting_todos(mock_get): | |
# Configure the mock to return a response with an OK status code. | |
mock_get.return_value.ok = True | |
# Call the service, which will send a request to the server. | |
response = get_todos() | |
# If the request is sent successfully, then I expect a response to be returned. | |
assert_is_not_none(response) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment