django test基本操做

在tests.py中,導入TestCase包 from django.test import TestCase 建立測試類: class SimpleTest(TestCase): 建立測試函數,必須以test_開頭 def test_login(self): 模擬客戶端發送數據 c=Client(HTTP_USER_AGENT='Mozilla/5.0') response=c.post('/
相關文章
相關標籤/搜索