I have extended a BaseHTTPRequestHandler and added a method. I'd like to unit test new_Method. I'm guessing there will be a mock somewhere. How do I start?
from http import server
class MyHandler(server.BaseHTTPRequestHandler): def do_GET(self): self.send_response(200) self.send_header("Content-type", "text/html") self.end_headers()
# Here's where all the complicated logic is done to generate HTML.
# For clarity here, replace with a simple stand-in:
html = "<html><p>hello world</p></html>"
self.wfile.write(html.encode())
def new_Method(self):
return 'a'
Aucun commentaire:
Enregistrer un commentaire