summaryrefslogtreecommitdiff
path: root/test/with_dummyserver/test_integration.py
blob: 7f6b4391650bfc5209ae59ce73ba053dc52262c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import pytest
import requests

from dummyserver.server import DEFAULT_CA
from dummyserver.testcase import HTTPDummyServerTestCase, HTTPSDummyServerTestCase


class TestHTTPIntegration(HTTPDummyServerTestCase):
    def test_requests_integration(self):
        with pytest.warns(DeprecationWarning) as records:
            response = requests.get(f"{self.scheme}://{self.host}:{self.port}")

        assert 200 == response.status_code
        msg = (
            "The 'strict' parameter is no longer needed on Python 3+. "
            "This will raise an error in urllib3 v3.0.0."
        )
        assert any(record.message.args[0] == msg for record in records)


class TestHTTPSIntegration(HTTPSDummyServerTestCase):
    def test_requests_integration(self):
        with pytest.warns(DeprecationWarning) as records:
            response = requests.get(
                f"{self.scheme}://{self.host}:{self.port}", verify=DEFAULT_CA
            )

        assert 200 == response.status_code
        msg = (
            "The 'strict' parameter is no longer needed on Python 3+. "
            "This will raise an error in urllib3 v3.0.0."
        )
        assert any(record.message.args[0] == msg for record in records)