new_contents: import mechanicalsoup
  
  
  def test_submit_online():
      """Complete and submit the pizza form at http://httpbin.org/forms/post """
      browser = mechanicalsoup.Browser()
      page = browser.get("http://httpbin.org/forms/post")
      form = mechanicalsoup.Form(page.soup.form)
  
      input_data = {"custname": "Philip J. Fry"}
      form.input(input_data)
  
      # leave custtel blank without value
      assert "value" not in form.find("input", {"name": "custtel"}).attrs
  
      check_data = {"size": "medium", "topping": "cheese", "topping": "onion"}
      form.check(check_data)
  
      form.textarea({"comments": "freezer"})
  
      response = browser.submit(form, page.url)
  
      # helpfully the form submits to http://httpbin.org/post which simply
      # returns the request headers in json format
      json = response.json()
      data = json["form"]
      assert data["custname"] == "Philip J. Fry"
      assert data["custtel"] == ""  # web browser submits "" for input left blank
      assert data["size"] == "medium"
      assert data["topping"] == ["cheese", "onion"]
      assert data["comments"] == "freezer"
  
subject: add test for form API