summaryrefslogtreecommitdiff
path: root/tests/test_hooks.py
blob: 014b439182373fc67d6bc72daf5292d87e43b181 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- 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': []}