????1?????????????

????2?????????????????????

????……
????????????????????????????????????????????????????????????????????ε?????Щ????????????
????????????
?????????д?????????????????漰???????????????????й????????unittest??????????request??
import unittest
import requests
class PollsTest(unittest.TestCase):
def setUp(self):
self.base_url = 'http://127.0.0.1:8000/polls'
def tearDown(self):
pass
def test_get_poll_index(self):
'''???????????'''
r = requests.get(self.base_url)
code = r.status_code
text = r.text
self.assertEqual(code?? 200)
def test_get_poll_question(self):
'''???????1?????????'''
r = requests.get(self.base_url+'/1/')
code = r.status_code
text = r.text
self.assertEqual(code?? 200)
self.assertIn("3"??text)
if __name__ == '__main__':
unittest.main()
????????????????????д???????????????y??????????????????????????????????????ɡ?