PyHamcrest 断言

http://hamcrest.org/

 

import requests
from hamcrest import *
def test_post_json(self):
    payload = {
        "level": 1,
        "name": "xuefeifei"
    }
    r = requests.post("https://httpbin.testing-studio.com/post", json=payload)
    print(r.json()
    assert_that(r.json()["json"]["level"] ,equal_to(1))

 

 



posted @ 2021-09-09 10:21  feifei_tian  阅读(46)  评论(0编辑  收藏  举报