def test_post_create_topic(tab, title, content, token=default_token): url = '/topics' topic = Topics(url) res = topic.post_create_topic(token, title, tab, content) assert res.status_code == 200 r = res.json() assert r['success'] == True
def test_post_topic(token, title, tab, content): url = "/topics" t = Topics(url) r = t.post_create_topic(token, title, tab, content) print(r.json()) res = r.json() topic_id = res['topic_id'] print("topic_id====", topic_id) assert r.status_code == 200 assert res['success'] == True
def get_topic_id(): """ fixture pytest的测试套件,可以作为基础操作方法被调用 """ url = "/topics" t = Topics(url) r = t.post_create_topic("3333a0fb-6dd8-439e-813b-2c3a5213a154", "11111111111", "ask", "xxxxxxxxxxxxx") print(r.json()) res = r.json() topic_id = res['topic_id'] return topic_id
def test_update_topic(tab, title, content, token=default_token): # create a content t1 = Topics('/topics') r = t1.post_create_topic(token=default_token, tab="ask", title="titlewithCreated", content="helloworld.........") res = r.json() print(res) topic_id = res['topic_id'] # update t2 = Topics('/topics/update') r2 = t2.post_update_topic(token, topic_id, tab, title, content) print(r2.json())