File: test_log_leak.py

package info (click to toggle)
pytest-httpserver 1.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 908 kB
  • sloc: python: 2,382; makefile: 77; sh: 21
file content (29 lines) | stat: -rw-r--r-- 562 bytes parent folder | download
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
import pytest
import requests

from pytest_httpserver import HTTPServer


class Client:
    def __init__(self) -> None:
        self.url: str | None = None

    def get(self):
        if self.url:
            requests.get(self.url)


@pytest.fixture
def my_fixture():
    client = Client()
    yield client
    client.get()


def test_1(my_fixture: Client, httpserver: HTTPServer):
    httpserver.expect_request("/foo").respond_with_data("OK")
    my_fixture.url = httpserver.url_for("/foo")


def test_2(httpserver: HTTPServer):
    assert httpserver.log == []