Example #1
0
 def testOrAnythingUnderTheMagicDirectoryToo(self):
     request = self.make_request('/app1/__/blah/blah/blah', Zope=True)
     task = Task(StubChannel(), request)
     try:
         task.process()
     except Response, response:
         self.assertEqual(response.code, 404)
Example #2
0
 def testDirectlyAccessingMagicDirectoryRaises404(self):
     request = self.make_request('/app1/__', Zope=True)
     task = Task(StubChannel(), request)
     try:
         task.process()
     except Response, response:
         self.assertEqual(response.code, 404)
Example #3
0
 def testSubdirStillMatches(self):
     request = self.make_request('/app1/foo/bar.html', Zope=True)
     task = Task(StubChannel(), request)
     try:
         task.process()
     except Response, response:
         self.assertEqual(response.code, 200)
Example #4
0
 def testAppNotThereRaises404(self):
     request = self.make_request('/not-there', Zope=True)
     task = Task(StubChannel(), request)
     try:
         task.process()
     except Response, response:
         self.assertEqual(response.code, 404)
Example #5
0
 def testBasic(self):
     request = self.make_request('/index.html', Zope=True)
     task = Task(StubChannel(), request)
     try:
         task.process()
     except Response, response:
         pass
Example #6
0
 def testNonRootAppWithNoMagicDirectoryRaises500(self):
     request = self.make_request('/app1', Zope=True)
     task = Task(StubChannel(), request)
     os.remove(self.convert_path('root/app1/__/app.py'))
     os.remove(self.convert_path('root/app1/__/app.pyc'))
     os.rmdir(self.convert_path('root/app1/__'))
     try:
         task.process()
     except Response, response:
         self.assertEqual(response.code, 500)
Example #7
0
 def testEtcPasswdCaughtByFindApp(self):
     request = self.make_request(
         '../../../../../../../../../../etc/master.passwd', Zope=True)
     task = Task(StubChannel(), request)
     expected = [
         "HTTP/1.0 500 Internal Server Error", "Content-Length: 25",
         "Content-Type: text/plain", "", "Internal Server Error", "", ""
     ]
     expected = '\r\n'.join(expected)
     actual = task.channel.getvalue()
     self.assertEqual(expected, actual)
Example #8
0
def DUMMY_TASK():
    return Task(StubChannel(), request)