Logo Search packages:      
Sourcecode: qm version File versions

def qm::test::web::web::QMTestServer::__init__ (   self,
  database,
  port,
  address,
  log_file,
  targets,
  context,
  expectations 
)

Create and bind an HTTP server.

'database' -- The test database to serve.

'port' -- The port number on which to accept HTTP requests.

'address' -- The local address to which to bind the server.  An
empty string indicates all local addresses.

'log_file' -- A file object to which the server will log requests.
'None' for no logging.

'targets' -- A sequence of 'Target' objects to use when running
tests.

'context' -- The 'Context' in which tests will execute.

Definition at line 1494 of file web.py.

                                                :
        """Create and bind an HTTP server.

        'database' -- The test database to serve.

        'port' -- The port number on which to accept HTTP requests.

        'address' -- The local address to which to bind the server.  An
        empty string indicates all local addresses.

        'log_file' -- A file object to which the server will log requests.
        'None' for no logging.

        'targets' -- A sequence of 'Target' objects to use when running
        tests.

        'context' -- The 'Context' in which tests will execute."""

        qm.web.WebServer.__init__(self, port, address, log_file=log_file)

        self.__database = database
        self.__targets = targets
        self.__context = context
        
        # Base URL path for QMTest stuff.
        script_base = "/test/"
        # Register all our web pages.
        for name, function in [
            ( "clear-results", self.HandleClearResults ),
            ( "create-resource", self.HandleShowItem ),
            ( "create-suite", self.HandleCreateSuite ),
            ( "create-test", self.HandleShowItem ),
            ( "delete-resource", self.HandleDeleteItem ),
            ( "delete-suite", self.HandleDeleteSuite ),
            ( "delete-test", self.HandleDeleteItem ),
            ( "dir", self.HandleDir ),
            ( "edit-context", self.HandleEditContext ),
            ( "edit-resource", self.HandleShowItem ),
            ( "edit-suite", self.HandleEditSuite ),
            ( "edit-test", self.HandleShowItem ),
            ( "load-context", self.HandleLoadContext ),
            ( "load-expectations", self.HandleLoadExpectations ),
            ( "load-results", self.HandleLoadResults ),
            ( "new-resource", self.HandleNewResource ),
            ( "new-suite", self.HandleNewSuite ),
            ( "new-test", self.HandleNewTest ),
            ( "run-tests", self.HandleRunTests ),
            ( "set-expectation", self.HandleSetExpectation ),
            ( "show-dir", self.HandleDir ),
            ( "show-resource", self.HandleShowItem ),
            ( "show-result", self.HandleShowResult ),
            ( "show-results", self.HandleShowResults ),
            ( "show-suite", self.HandleShowSuite ),
            ( "show-test", self.HandleShowItem ),
            ( "shutdown", self.HandleShutdown ),
            ( "stop-tests", self.HandleStopTests ),
            ( "submit-context", self.HandleSubmitContext ),
            ( "submit-context-file", self.HandleSubmitContextFile ),
            ( "submit-expectation", self.HandleSubmitExpectation ),
            ( "submit-resource", self.HandleSubmitItem ),
            ( "submit-expectations", self.HandleSubmitExpectations ),
            ( "submit-expectations-form", self.HandleSubmitExpectationsForm ),
            ( "submit-results", self.HandleSubmitResults ),
            ( "submit-suite", self.HandleSubmitSuite ),
            ( "submit-test", self.HandleSubmitItem ),
            ( qm.test.cmdline.QMTest.context_file_name,
              self.HandleSaveContext ),
            ( qm.test.cmdline.QMTest.expectations_file_name,
              self.HandleSaveExpectations ),
            ( qm.test.cmdline.QMTest.results_file_name,
              self.HandleSaveResults ),
            ]:
            self.RegisterScript(script_base + name, function)
        self.RegisterPathTranslation(
            "/stylesheets", qm.get_share_directory("web", "stylesheets"))
        self.RegisterPathTranslation(
            "/images", qm.get_share_directory("web", "images"))
        self.RegisterPathTranslation(
            "/static", qm.get_share_directory("web", "static"))
        # Register the QM manual.
        self.RegisterPathTranslation(
            "/manual", qm.get_doc_directory("test", "html"))

        # The DB's attachment store processes download requests for
        # attachment data.
        attachment_store = database.GetAttachmentStore()
        if attachment_store:
            self.RegisterScript(qm.fields.AttachmentField.download_url,
                                attachment_store.HandleDownloadRequest)

        self.__expected_outcomes = expectations
        # There are no results yet.        
        self.__results_stream = StorageResultsStream()
        self.__results_stream.Summarize()
        # There is no execution thread.
        self.__execution_thread = None
        
        # Bind the server to the specified address.
        try:
            self.Bind()
        except qm.web.AddressInUseError, address:
            raise RuntimeError, qm.error("address in use", address=address)
        except qm.web.PrivilegedPortError:
            raise RuntimeError, qm.error("privileged port", port=port)


    def GetContext(self):


Generated by  Doxygen 1.6.0   Back to index