request_test_lib.py: Move from mock to unittest.mock.

This commit changes 'Mock.assert_called()' to 'assert Mock.called'.
This is needed because in unittest.mock, assert_called() is only
supported in Python >=3.6.
This commit is contained in:
Robert Hönig 2018-01-05 22:23:36 +01:00
parent b46a079804
commit e48a958780

View file

@ -2,7 +2,7 @@ import json
import requests
from contextlib import contextmanager
from mock import patch
from unittest.mock import patch
from typing import Any, Dict, List
@ -77,7 +77,7 @@ def mock_request_exception():
# type: () -> Any
def assert_mock_called(mock_result):
# type: (Any) -> None
mock_result.assert_called()
assert mock_result.called
with patch('requests.get') as mock_get:
mock_get.return_value = True