Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 2074

Show
Ignore:
Timestamp:
11/08/08 14:35:20
Author:
fumanchu
Message:

Merged apache/wsgi test silencers from trunk.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/cherrypy-3.1.x/cherrypy/test/modfcgid.py

    r2068 r2074  
    105105     
    106106    def _run(self, conf): 
     107        cherrypy.server.using_wsgi = True 
     108        cherrypy.server.using_apache = True 
    107109        cherrypy.server.httpserver = servers.FlupFCGIServer( 
    108110            application=cherrypy.tree, bindAddress=('127.0.0.1', 4000)) 
  • branches/cherrypy-3.1.x/cherrypy/test/modpy.py

    r1824 r2074  
    6262# Apache2 server conf file for testing CherryPy with modpython_gateway. 
    6363 
     64ServerName 127.0.0.1 
    6465DocumentRoot "/" 
    6566Listen %s 
     
    7879# Apache2 server conf file for testing CherryPy with _cpmodpy. 
    7980 
     81ServerName 127.0.0.1 
    8082DocumentRoot "/" 
    8183Listen %s 
     
    156158     
    157159    def _run(self, conf): 
     160        import cherrypy 
     161        cherrypy.server.using_apache = True 
     162         
    158163        from cherrypy.test import webtest 
    159164        webtest.WebCase.PORT = self.port 
     
    165170         
    166171        if self.use_wsgi: 
     172            cherrypy.server.using_wsgi = True 
    167173            conf_template = conf_modpython_gateway 
    168174        else: 
     175            cherrypy.server.using_wsgi = False 
    169176            conf_template = conf_cpmodpy 
    170177         
  • branches/cherrypy-3.1.x/cherrypy/test/modwsgi.py

    r2068 r2074  
    117117     
    118118    def _run(self, conf): 
     119        cherrypy.server.using_wsgi = True 
     120        cherrypy.server.using_apache = True 
     121         
    119122        from cherrypy.test import webtest 
    120123        webtest.WebCase.PORT = self.port 
  • branches/cherrypy-3.1.x/cherrypy/test/test.py

    r2068 r2074  
    4949        print "PID:", os.getpid() 
    5050        print 
     51         
     52        # Override these in _run as needed: 
     53        cherrypy.server.using_wsgi = True 
     54        cherrypy.server.using_apache = False 
    5155         
    5256        if isinstance(conf, basestring): 
  • branches/cherrypy-3.1.x/cherrypy/test/test_caching.py

    r1797 r2074  
    205205        self.assertStatus(304) 
    206206        self.assertNoHeader("Last-Modified") 
    207         self.assertHeader("Age") 
     207        if not getattr(cherrypy.server, "using_apache", False): 
     208            self.assertHeader("Age") 
    208209 
    209210 
  • branches/cherrypy-3.1.x/cherrypy/test/test_config.py

    r1724 r2074  
    171171        self.assertBody(repr(cherrypy.lib.http.response_codes[404])) 
    172172         
    173         self.getPage("/repr?key=thing2") 
    174         from cherrypy.tutorial import thing2 
    175         self.assertBody(repr(thing2)) 
     173        if not getattr(cherrypy.server, "using_apache", False): 
     174            # The object ID's won't match up when using Apache, since the 
     175            # server and client are running in different processes. 
     176            self.getPage("/repr?key=thing2") 
     177            from cherrypy.tutorial import thing2 
     178            self.assertBody(repr(thing2)) 
    176179         
    177180        self.getPage("/repr?key=complex") 
  • branches/cherrypy-3.1.x/cherrypy/test/test_core.py

    r2071 r2074  
    1818 
    1919defined_http_methods = ("OPTIONS", "GET", "HEAD", "POST", "PUT", "DELETE", 
    20                         "TRACE", "CONNECT", "PROPFIND") 
     20                        "TRACE", "PROPFIND") 
    2121 
    2222 
     
    385385        def index(self): 
    386386            m = cherrypy.request.method 
    387             if m in defined_http_methods
     387            if m in defined_http_methods or m == "CONNECT"
    388388                return m 
    389389             
     
    589589        self.assertErrorPage(500, msg) 
    590590         
    591         self.getPage("/status/unknown") 
    592         self.assertBody('funky') 
    593         self.assertStatus(431) 
     591        if not getattr(cherrypy.server, 'using_apache', False): 
     592            self.getPage("/status/unknown") 
     593            self.assertBody('funky') 
     594            self.assertStatus(431) 
    594595         
    595596        self.getPage("/status/bad") 
     
    753754            self.assertErrorPage(500, pattern=valerr) 
    754755             
    755             if cherrypy.server.protocol_version == "HTTP/1.0": 
     756            if (cherrypy.server.protocol_version == "HTTP/1.0" or 
     757                getattr(cherrypy.server, "using_apache", False)): 
    756758                self.getPage("/error/page_streamed") 
    757759                # Because this error is raised after the response body has 
     
    796798        self.assertInBody(msg) 
    797799         
    798         if (hasattr(self, 'harness') and 
    799             "modpython" in self.harness.__class__.__name__.lower()): 
     800        if getattr(cherrypy.server, "using_apache", False): 
    800801            pass 
    801802        else: 
     
    961962        self.assertBody("application/json") 
    962963     
    963     def testHTTPMethods(self): 
     964    def test_basic_HTTPMethods(self): 
    964965        helper.webtest.methods_with_bodies = ("POST", "PUT", "PROPFIND") 
    965966         
     
    10461047        self.assertStatus(200) 
    10471048     
     1049    def test_CONNECT_method(self): 
     1050        if getattr(cherrypy.server, "using_apache", False): 
     1051            print "skipped due to known Apache differences...", 
     1052            return 
     1053         
     1054        self.getPage("/method/", method="CONNECT") 
     1055        self.assertBody("CONNECT") 
     1056     
    10481057    def testFavicon(self): 
    10491058        # favicon.ico is served by staticfile. 
     
    10791088     
    10801089    def testMaxRequestSize(self): 
     1090        if getattr(cherrypy.server, "using_apache", False): 
     1091            print "skipped due to known Apache differences...", 
     1092            return 
     1093         
    10811094        for size in (500, 5000, 50000): 
    10821095            self.getPage("/", headers=[('From', "x" * 500)]) 
  • branches/cherrypy-3.1.x/cherrypy/test/test_encoding.py

    r2071 r2074  
    155155        # and 2) we may have already written some of the body. 
    156156        # The fix is to never stream yields when using gzip. 
    157         if cherrypy.server.protocol_version == "HTTP/1.0": 
     157        if (cherrypy.server.protocol_version == "HTTP/1.0" or 
     158            getattr(cherrypy.server, "using_apache", False)): 
    158159            self.getPage('/gzip/noshow_stream', 
    159160                         headers=[("Accept-Encoding", "gzip")]) 
  • branches/cherrypy-3.1.x/cherrypy/test/test_http.py

    r2068 r2074  
    105105 
    106106    def test_malformed_request_line(self): 
     107        if getattr(cherrypy.server, "using_apache", False): 
     108            print "skipped due to known Apache differences...", 
     109            return 
     110         
    107111        # Test missing version in Request-Line 
    108112        if self.scheme == 'https': 
  • branches/cherrypy-3.1.x/cherrypy/test/test_httpauth.py

    r1891 r2074  
    139139        auth = base_auth % (nonce, response, '00000001') 
    140140        self.getPage('/digest/', [('Authorization', auth)]) 
    141         self.assertStatus('401 Unauthorized'
     141        self.assertStatus(401
    142142 
    143143        # Test that must pass 
  • branches/cherrypy-3.1.x/cherrypy/test/test_objectmapping.py

    r2068 r2074  
    221221            self.assertHeader('Location', '%s/dir1/' % self.base()) 
    222222             
    223             # Test that we can use URL's which aren't all valid Python identifiers 
    224             # This should also test the %XX-unquoting of URL's. 
    225             self.getPage("/Von%20B%fclow?ID=14") 
    226             self.assertBody("ID is 14") 
    227              
    228             # Test that %2F in the path doesn't get unquoted too early; 
    229             # that is, it should not be used to separate path components. 
    230             # See ticket #393. 
    231             self.getPage("/page%2Fname") 
    232             self.assertBody("default:('page/name',)") 
     223            if not getattr(cherrypy.server, "using_apache", False): 
     224                # Test that we can use URL's which aren't all valid Python identifiers 
     225                # This should also test the %XX-unquoting of URL's. 
     226                self.getPage("/Von%20B%fclow?ID=14") 
     227                self.assertBody("ID is 14") 
     228                 
     229                # Test that %2F in the path doesn't get unquoted too early; 
     230                # that is, it should not be used to separate path components. 
     231                # See ticket #393. 
     232                self.getPage("/page%2Fname") 
     233                self.assertBody("default:('page/name',)") 
    233234             
    234235            self.getPage("/dir1/dir2/script_name") 
  • branches/cherrypy-3.1.x/cherrypy/test/test_tools.py

    r2071 r2074  
    264264         
    265265        # If body is "razdrez", then on_end_request is being called too early. 
    266         if cherrypy.server.protocol_version == "HTTP/1.0": 
     266        if (cherrypy.server.protocol_version == "HTTP/1.0" or 
     267            getattr(cherrypy.server, "using_apache", False)): 
    267268            self.getPage("/demo/errinstream?id=5") 
    268269            # Because this error is raised after the response body has 
  • branches/cherrypy-3.1.x/cherrypy/test/test_wsgi_vhost.py

    r1670 r2074  
    3535     
    3636    def test_welcome(self): 
     37        if not cherrypy.server.using_wsgi: 
     38            print "skipped (not using WSGI)...", 
     39            return 
     40         
    3741        for year in xrange(1997, 2008): 
    3842            self.getPage("/", headers=[('Host', 'www.classof%s.example' % year)]) 
  • branches/cherrypy-3.1.x/cherrypy/test/test_wsgiapps.py

    r1804 r2074  
    8989     
    9090    def test_04_pure_wsgi(self): 
     91        import cherrypy 
     92        if not cherrypy.server.using_wsgi: 
     93            print "skipped (not using WSGI)...", 
     94            return 
    9195        self.getPage("/hosted/app1") 
    9296        self.assertHeader("Content-Type", "text/plain") 
     
    9498 
    9599    def test_05_wrapped_cp_app(self): 
     100        import cherrypy 
     101        if not cherrypy.server.using_wsgi: 
     102            print "skipped (not using WSGI)...", 
     103            return 
    96104        self.getPage("/hosted/app2/") 
    97105        body = list("I'm a regular CherryPy page handler!") 
     
    101109 
    102110    def test_06_empty_string_app(self): 
     111        import cherrypy 
     112        if not cherrypy.server.using_wsgi: 
     113            print "skipped (not using WSGI)...", 
     114            return 
    103115        self.getPage("/hosted/app3") 
    104116        self.assertHeader("Content-Type", "text/plain") 

Hosted by WebFaction

Log in as guest/cpguest to create tickets