Skip to content

Commit 335e447

Browse files
committed
Add test
1 parent d87fcf9 commit 335e447

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test_matcher.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import requests
2+
3+
from pytest_httpserver import HTTPServer
4+
5+
6+
def test_expect_methods_are_equivalent(httpserver: HTTPServer):
7+
expected_response = "OK"
8+
matcher = httpserver.create_matcher(uri="/test", method="POST")
9+
httpserver.expect(matcher).respond_with_data(expected_response)
10+
resp = requests.post(httpserver.url_for("/test"), json={"list": [1, 2, 3, 4]})
11+
assert resp.text == expected_response
12+
httpserver.clear()
13+
14+
httpserver.expect_request("/test", method="POST").respond_with_data("OK")
15+
resp = requests.post(httpserver.url_for("/test"), json={"list": [1, 2, 3, 4]})
16+
assert resp.text == expected_response

0 commit comments

Comments
 (0)