pytest 第一程序

2020-03-30  本文已影响0人  shan317
import requests
import pytest


class TestV2Api(object):
    domain = "https://www.v2ex.com/"

    @pytest.mark.timeout(2)
    def test_user_reg(self):
        path = "api/nodes/show.json?name=python"
        url = TestV2Api.domain + path
        res = requests.get(url).json()
        assert res["id"] == 90
        assert res["name"] == "python"
        assert "语言编程话题" in res["header"]

教程后续更新

上一篇 下一篇

猜你喜欢

热点阅读