def test_chain_of_different_with_errors(server: FakeServer):
requests.patch(server.base_uri + "/users", json={"name": "new_name"})
with pytest.raises(AssertionError) as error:
expect_that(server.was_requested("patch", "/users").
for_the_first_time().
with_content_type("text/plain").
with_body("old name"))
assert str(error.value) == ("Expect that server was requested with [PATCH] http://localhost:8081/users.\n"
"For the 1 time: with content type 'text/plain'.\n"
"But for the 1 time: content type was 'application/json'.\n"
"For the 1 time: with body 'old name'.\n"
"But for the 1 time: body was '{\"name\": \"new_name\"}'.")
test_fake_server_expectations.py 文件源码
python
阅读 42
收藏 0
点赞 0
评论 0
评论列表
文章目录