code: def test_iweb(self, task: str = None):
      import threading
      import random
      import requests
      import json
      import parlai.scripts.interactive_web as iweb
  
      port = random.randint(30000, 40000)
      kwargs = {"model": "repeat_query", "port": port}
      if task:
          kwargs["task"] = task
      thread = threading.Thread(
          target=iweb.InteractiveWeb.main, kwargs=kwargs, daemon=True
      )
      thread.start()
      iweb.wait()
  
      r = requests.get(f"http://localhost:{port}/")
      assert "<html>" in r.text
  
      r = requests.post(
          f"http://localhost:{port}/interact", data="This is a test"
      )
      assert r.status_code == 200
      response = json.loads(r.text)
      assert "text" in response
      assert response["text"] == "This is a test"
  
      r = requests.post(f"http://localhost:{port}/reset")
      assert r.status_code == 200
      response = json.loads(r.text)
      assert response == {}
  
      r = requests.get(f"http://localhost:{port}/bad")
      assert r.status_code == 500
  
      r = requests.post(f"http://localhost:{port}/bad")
      assert r.status_code == 500
  
      iweb.shutdown()
  
imports: import unittest
  from unittest import mock
  import os
  from parlai.scripts.interactive import Interactive
  from parlai.scripts.safe_interactive import SafeInteractive
  import parlai.utils.conversations
  import parlai.utils.testing
label_desc: Use image node_id 1 for calling the TestInteractiveWeb obj's underlying member method code with example usage: obj.test_iweb(task) without return types