r6258 - in flumotion/trunk: . flumotion/component/misc/httpfile flumotion/test

flumotion-commit at lists.fluendo.com flumotion-commit at lists.fluendo.com
Wed Feb 20 13:26:31 CET 2008


Author: jdahlin
Date: Wed Feb 20 13:26:29 2008
New Revision: 6258

Log:
2008-02-20  Johan Dahlin  <johan at gnome.org>

    * flumotion/test/test_component_httpserver.py (MountTest): 
    Chain deferred by using DeferredList with fireOnOneErroback enabled, half of
    the tests before this change were actually failing.
    * flumotion/component/misc/httpfile/httpfile.py
    (HTTPFileStreamer._getDefaultRootResource): Do not strip the leading character,
    it will be done later in _createRootResourceForPath().



Modified:
   flumotion/trunk/ChangeLog
   flumotion/trunk/flumotion/component/misc/httpfile/httpfile.py
   flumotion/trunk/flumotion/test/test_component_httpserver.py

Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog	(original)
+++ flumotion/trunk/ChangeLog	Wed Feb 20 13:26:29 2008
@@ -1,3 +1,12 @@
+2008-02-20  Johan Dahlin  <johan at gnome.org>
+
+	* flumotion/test/test_component_httpserver.py (MountTest): 
+	Chain deferred by using DeferredList with fireOnOneErroback enabled, half of
+	the tests before this change were actually failing.
+	* flumotion/component/misc/httpfile/httpfile.py
+	(HTTPFileStreamer._getDefaultRootResource): Do not strip the leading character,
+	it will be done later in _createRootResourceForPath().
+
 2008-02-19  Michael Smith <msmith at fluendo.com>
 
 	* flumotion/component/misc/httpfile/Makefile.am:

Modified: flumotion/trunk/flumotion/component/misc/httpfile/httpfile.py
==============================================================================
--- flumotion/trunk/flumotion/component/misc/httpfile/httpfile.py	(original)
+++ flumotion/trunk/flumotion/component/misc/httpfile/httpfile.py	Wed Feb 20 13:26:29 2008
@@ -376,7 +376,7 @@
 
         root = factory.create(self.filePath)
         if self.mountPoint != '/':
-            root = self._createRootResourceForPath(self.mountPoint[1:], root)
+            root = self._createRootResourceForPath(self.mountPoint, root)
 
         return root
 

Modified: flumotion/trunk/flumotion/test/test_component_httpserver.py
==============================================================================
--- flumotion/trunk/flumotion/test/test_component_httpserver.py	(original)
+++ flumotion/trunk/flumotion/test/test_component_httpserver.py	Wed Feb 20 13:26:29 2008
@@ -80,12 +80,14 @@
 
         d = client.getPage(self.getURL('/A'))
         d.addCallback(lambda r: self.assertEquals(r, 'test file A'))
-        d.addCallback(lambda r: client.getPage(self.getURL('/B/C')))
-        d.addCallback(lambda r: self.assertEquals(r, 'test file C'))
+
+        d2 = client.getPage(self.getURL('/B/C'))
+        d2.addCallback(lambda r: self.assertEquals(r, 'test file C'))
+
         # getting a non-existing resource should give web.error.Error
-        d.addCallback(lambda r: client.getPage(self.getURL('/B/D')))
-        d.addErrback(lambda f: f.trap(error.Error))
-        return d
+        d3 = client.getPage(self.getURL('/B/D'))
+        d3.addErrback(lambda f: f.trap(error.Error))
+        return defer.DeferredList([d, d2, d3], fireOnOneErrback=True)
 
     def testDirMountRoot(self):
         properties = {
@@ -97,12 +99,15 @@
 
         d = client.getPage(self.getURL('/A'))
         d.addCallback(lambda r: self.assertEquals(r, 'test file A'))
-        d.addCallback(lambda r: client.getPage(self.getURL('/B/C')))
-        d.addCallback(lambda r: self.assertEquals(r, 'test file C'))
+
+        d2 = client.getPage(self.getURL('/B/C'))
+        d2.addCallback(lambda r: self.assertEquals(r, 'test file C'))
+
         # getting a non-existing resource should give web.error.Error
-        d.addCallback(lambda r: client.getPage(self.getURL('/B/D')))
-        d.addErrback(lambda f: f.trap(error.Error))
-        return d
+        d3 = client.getPage(self.getURL('/B/D'))
+        d3.addErrback(lambda f: f.trap(error.Error))
+
+        return defer.DeferredList([d, d2, d3], fireOnOneErrback=True)
 
     def testDirMountOnDemand(self):
         properties = {
@@ -114,14 +119,15 @@
 
         d = client.getPage(self.getURL('/ondemand/A'))
         d.addCallback(lambda r: self.assertEquals(r, 'test file A'))
-        d.addCallback(lambda r: client.getPage(self.getURL('/ondemand/B/C')))
-        d.addCallback(lambda r: self.assertEquals(r, 'test file C'))
+        d2 = client.getPage(self.getURL('/ondemand/B/C'))
+        d2.addCallback(lambda r: self.assertEquals(r, 'test file C'))
         # getting a non-existing resource should give web.error.Error
-        d.addCallback(lambda r: client.getPage(self.getURL('/A')))
-        d.addErrback(lambda f: f.trap(error.Error))
-        d.addCallback(lambda r: client.getPage(self.getURL('/ondemand/B/D')))
-        d.addErrback(lambda f: f.trap(error.Error))
-        return d
+        d3 = client.getPage(self.getURL('/A'))
+        d3.addErrback(lambda f: f.trap(error.Error))
+        d4 = client.getPage(self.getURL('/ondemand/B/D'))
+        d4.addErrback(lambda f: f.trap(error.Error))
+
+        return defer.DeferredList([d, d2, d3, d4], fireOnOneErrback=True)
 
     def testFileMountEmpty(self):
         properties = {
@@ -131,17 +137,17 @@
         }
         self.makeComponent(properties)
 
-        d = defer.Deferred()
-        # FIXME: what if just the server URL is requested ?
-        #d.addCallback(lambda r: client.getPage(self.getURL('')))
-        #d.addCallback(lambda r: self.assertEquals(r, 'test file A'))
-        d.addCallback(lambda r: client.getPage(self.getURL('/')))
-        d.addCallback(lambda r: self.assertEquals(r, 'test file A'))
+        d1 = client.getPage(self.getURL('/'))
+        d1.addCallback(lambda r: self.assertEquals(r, 'test file A'))
+
         # getting a non-existing resource should give web.error.Error
-        d.addCallback(lambda r: client.getPage(self.getURL('/B/D')))
-        d.addErrback(lambda f: f.trap(error.Error))
-        d.callback(None)
-        return d
+        d2 = client.getPage(self.getURL('/B/D'))
+        d2.addErrback(lambda f: f.trap(error.Error))
+
+        d3 = client.getPage(self.getURL(''))
+        d3.addCallback(lambda r: self.assertEquals(r, 'test file A'))
+
+        return defer.DeferredList([d1, d2, d3], fireOnOneErrback=True)
 
     def testFileMountOnDemand(self):
         properties = {
@@ -151,14 +157,15 @@
         }
         self.makeComponent(properties)
 
-        d = client.getPage(self.getURL('/ondemand'))
-        d.addCallback(lambda r: self.assertEquals(r, 'test file A'))
+        d1 = client.getPage(self.getURL('/ondemand'))
+        d1.addCallback(lambda r: self.assertEquals(r, 'test file A'))
         # getting a non-existing resource should give web.error.Error
-        d.addCallback(lambda r: client.getPage(self.getURL('/A')))
-        d.addErrback(lambda f: f.trap(error.Error))
-        d.addCallback(lambda r: client.getPage(self.getURL('/ondemand/B/D')))
-        d.addErrback(lambda f: f.trap(error.Error))
-        return d
+        d2 = client.getPage(self.getURL('/A'))
+        d2.addErrback(lambda f: f.trap(error.Error))
+        d3 = client.getPage(self.getURL('/ondemand/B/D'))
+        d3.addErrback(lambda f: f.trap(error.Error))
+        return defer.DeferredList([d1, d2, d3], fireOnOneErrback=True)
+
 
 class _Resource(Resource):
     def __init__(self):


More information about the flumotion-commit mailing list