File: test_fingerprintadapter.py

package info (click to toggle)
python-requests-toolbelt 1.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 876 kB
  • sloc: python: 3,653; makefile: 166; sh: 7
file content (20 lines) | stat: -rw-r--r-- 709 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# -*- coding: utf-8 -*-
import requests
import unittest

from requests_toolbelt.adapters.fingerprint import FingerprintAdapter
from . import get_betamax


class TestFingerprintAdapter(unittest.TestCase):
    HTTP2BIN_FINGERPRINT = 'abf8683eeba8521ad2e8dc48e92a1cbea3ff8608f1417948fdad75d7b50eb264'

    def setUp(self):
        self.session = requests.Session()
        self.session.mount('https://http2bin.org', FingerprintAdapter(self.HTTP2BIN_FINGERPRINT))
        self.recorder = get_betamax(self.session)

    def test_fingerprint(self):
        with self.recorder.use_cassette('http2bin_fingerprint'):
            r = self.session.get('https://http2bin.org/get')
            assert r.status_code == 200