Sylvain Hellegouarch avatar Sylvain Hellegouarch committed cccd2ac

Test and fix for #706

Comments (0)

Files changed (2)


             action = result.get('action', None)
             if action is not None:
-                handler = getattr(controller, action)
+                handler = getattr(controller, action, None)
                 # Get config from the handler 
                 if hasattr(handler, "_cp_config"): 


 def setup_server():
+    class Dummy:
+        def index(self):
+            return "I said good day!"
     class City:
               action='index', conditions=dict(method=['GET']))
     d.mapper.connect('surbiton', controller='surbiton',
                      action='update', conditions=dict(method=['POST']))
+    d.connect('main', ':action', controller=Dummy())
     conf = {'/': {'request.dispatch': d}}
     cherrypy.tree.mount(root=None, config=conf)
         self.assertStatus("200 OK")
         self.assertBody("Welcome to Hounslow, pop. 10000")
+        self.getPage("/foo")
+        self.assertStatus("404 Not Found")
         self.assertStatus("200 OK")
         self.assertBody("Welcome to Surbiton, pop. 10000")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.