我正在为 Django 视图编写单元测试。
class TestLog(unittest.TestCase):
"""Test for Contact"""
def setUp(self):
self.c = Client()
try:
self.bob = User.objects.create_user("mojo","b@example.com", "bmojo")
except :
print ''
def test_get_emails(self):
response = self.c.get('/text/')
self.assertEqual(response.status_code, 200)
def test_htmlemils(self):
response = self.c.get('/emails/html/upload')
self.assertEqual(response.status_code, 200)
c = Client() 将“http://testserver”作为我要覆盖的域,我想在该测试客户端中添加我的真实域,他们是自定义测试客户端的方式吗?