mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 14:50:16 +00:00
Added unit tests for hooks module
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
# coding: utf-8
|
||||
import pytest
|
||||
|
||||
from requests import hooks
|
||||
|
||||
|
||||
def hook(value):
|
||||
return value[1:]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'hooks_list, result', (
|
||||
(hook, 'ata'),
|
||||
([hook, lambda x: None, hook], 'ta'),
|
||||
)
|
||||
)
|
||||
def test_hooks(hooks_list, result):
|
||||
assert hooks.dispatch_hook('response', {'response': hooks_list}, 'Data') == result
|
||||
|
||||
|
||||
def test_default_hooks():
|
||||
assert hooks.default_hooks() == {'response': []}
|
||||
Reference in New Issue
Block a user