File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
libpythonpro/tests/test_spam Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 6
6
7
7
8
8
@pytest .fixture
9
- def avatar_url ():
9
+ def avatar_url (mocker ):
10
10
resp_mock = Mock ()
11
11
url = 'https://avatars3.githubusercontent.com/u/402714?v=4'
12
12
resp_mock .json .return_value = {
13
13
'login' : 'renzo' , 'id' : 402714 ,
14
14
'avatar_url' : url ,
15
15
}
16
- get_original = github_api .requests .get
17
- github_api .requests .get = Mock (return_value = resp_mock )
18
- yield url
19
- github_api .requests .get = get_original
16
+ get_mock = mocker .patch ('libpythonpro.github_api.requests.get' )
17
+ get_mock .return_value = resp_mock
18
+ return url
20
19
21
20
22
21
def test_buscar_avatar (avatar_url ):
Original file line number Diff line number Diff line change @@ -16,4 +16,6 @@ pytest==3.5.1
16
16
coverage == 4.5.1
17
17
pytest-cov == 2.5.1
18
18
19
+ pytest-mock-1.10.0
20
+
19
21
-r requirements.txt
You can’t perform that action at this time.
0 commit comments