old_contents: #!/usr/bin/env python
  
  from urllib2 import urlopen
  from socket import gethostname
  
  from circuits import Component
  from circuits.web import Controller
  from circuits.web import BaseServer, Server
  
  class BaseRoot(Component):
  
      channel = "web"
  
      def request(self, request, response):
          return "Hello World!"
  
  class Root(Controller):
  
      def index(self):
          return "Hello World!"
  
  def test_baseserver():
      server = BaseServer(("0.0.0.0", 9000))
      BaseRoot().register(server)
      server.start()
  
      hostname = gethostname()
      assert server.host == "%s:9000" % hostname
  
      f = urlopen(server.base)
      s = f.read()
      assert s == "Hello World!"
  
  def test_server():
      server = Server("0.0.0.0:9001")
      Root().register(server)
      server.start()
  
      hostname = gethostname()
      assert server.host == "%s:9001" % hostname
  
      f = urlopen(server.base)
      s = f.read()
      assert s == "Hello World!"
  
      server.stop()
  
new_contents: #!/usr/bin/env python
  
  from urllib2 import urlopen
  from socket import gethostname
  
  from circuits import Component
  from circuits.web import Controller
  from circuits.web import BaseServer, Server
  
  class BaseRoot(Component):
  
      channel = "web"
  
      def request(self, request, response):
          return "Hello World!"
  
  class Root(Controller):
  
      def index(self):
          return "Hello World!"
  
  def test_baseserver():
      server = BaseServer(("0.0.0.0", 9000))
      BaseRoot().register(server)
      server.start()
  
      hostname = gethostname()
      assert server.host == "%s:9000" % hostname
  
      f = urlopen(server.base)
      s = f.read()
      assert s == "Hello World!"
  
  def test_server():
      server = Server("0.0.0.0:9001")
      Root().register(server)
      server.start()
  
      hostname = gethostname()
      assert server.host == "%s:9001" % hostname
  
      f = urlopen(server.base)
      s = f.read()
      assert s == "Hello World!"
  
  def test_unixserver():
      server = Server("test.sock")
      Root().register(server)
      server.start()
  
      assert server.host == "test.sock"
  
subject: Add basic test for UNIX servers"