def test_handler_called_nth_times(server: FakeServer):
server. \
on_("patch", "/songs"). \
response(status=204)._3_times()
response_0 = requests.patch(server.base_uri + "/songs")
response_1 = requests.patch(server.base_uri + "/songs")
response_2 = requests.patch(server.base_uri + "/songs")
response_3 = requests.patch(server.base_uri + "/songs")
assert response_0.status_code == 204
assert response_1.status_code == 204
assert response_2.status_code == 204
assert response_3.status_code == 500
assert response_3.text == "Server has not responses for [PATCH] http://localhost:8081/songs"
assert response_3.headers["content-type"] == "text/plain"
评论列表
文章目录