File: test_matcher.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 (11 lines) | stat: -rw-r--r-- 398 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
import requests

from pytest_httpserver import HTTPServer


def test_expect_method(httpserver: HTTPServer):
    expected_response = "OK"
    matcher = httpserver.create_matcher(uri="/test", method="POST")
    httpserver.expect(matcher).respond_with_data(expected_response)
    resp = requests.post(httpserver.url_for("/test"), json={"list": [1, 2, 3, 4]})
    assert resp.text == expected_response