]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
web: don't break status page when there is no helper running
authorBrian Warner <warner@lothar.com>
Tue, 15 Apr 2008 06:42:20 +0000 (23:42 -0700)
committerBrian Warner <warner@lothar.com>
Tue, 15 Apr 2008 06:42:20 +0000 (23:42 -0700)
src/allmydata/client.py
src/allmydata/test/test_system.py

index bcab46027e7404cf42b762d0d89b68ff87a38b71..71fd6f620748bf9f98fbc44447ecb719c3bd32a6 100644 (file)
@@ -371,9 +371,15 @@ class Client(node.Node, testutil.PollMixin):
         return watcher.list_recent_retrieve()
 
     def list_active_helper_statuses(self):
-        helper = self.getServiceNamed("helper")
+        try:
+            helper = self.getServiceNamed("helper")
+        except KeyError:
+            return []
         return helper.get_active_upload_statuses()
     def list_recent_helper_statuses(self):
-        helper = self.getServiceNamed("helper")
+        try:
+            helper = self.getServiceNamed("helper")
+        except KeyError:
+            return []
         return helper.get_recent_upload_statuses()
 
index 1aa682a59bb2fd019e9bba1b13f453140c678a17..e25b4fb2339839b8fd964ee925b358ef2526f6f0 100644 (file)
@@ -1347,8 +1347,13 @@ class SystemTest(testutil.SignalMixin, testutil.PollMixin, unittest.TestCase):
         d.addCallback(_got_helper_status_json)
 
         # and check that client[3] (which uses a helper but does not run one
-        # itself) doesn't explode when you ask for its helper status with
-        # t=json
+        # itself) doesn't explode when you ask for its status
+        d.addCallback(lambda res: getPage(self.helper_webish_url + "status/"))
+        def _got_non_helper_status(res):
+            self.failUnless("Upload and Download Status" in res)
+        d.addCallback(_got_non_helper_status)
+
+        # or for helper status with t=json
         d.addCallback(lambda res:
                       getPage(self.helper_webish_url + "helper_status?t=json"))
         def _got_non_helper_status_json(res):