我是单元测试的初学者。我想知道如何对以下功能进行模拟单元测试。
import ...
class A(BaseHTTPRequestHandler):
def do_GET(self):
client_ip = self.client_address[0]
if client_id == '10.10.10.10':
self._set_headers_200()
return
else:
self._set_headers_400()
return
测试类:
import unittest
def test_A_get():
I want to test both 200 and 400 response
有人可以帮我解决这个问题吗?