擅长:python、mysql、java
<p>好吧,你可以提出一个实际的post请求</p>
<pre><code>import requests
def test_post():
resp = requests.post('http://localhost/name',
data={'arg': 'value'},
cookies={'from-my': 'browser'})
assert resp.status_code == 200
</code></pre>
<p>我建议使用<a href="http://pytest.org/latest/" rel="nofollow">py.test</a>而不是unittest,但是如果必须使用unittest</p>
^{pr2}$