diff --git src/allmydata/test/test_web.py src/allmydata/test/test_web.py index 2483236..826d44a 100644 --- src/allmydata/test/test_web.py +++ src/allmydata/test/test_web.py @@ -79,6 +79,8 @@ class FakeNodeMaker(NodeMaker): class FakeUploader(service.Service): name = "uploader" + helper_furl = None + helper_connected = False def upload(self, uploadable): d = uploadable.get_size() d.addCallback(lambda size: uploadable.read(size)) @@ -100,7 +102,7 @@ class FakeUploader(service.Service): d.addCallback(_got_data) return d def get_helper_info(self): - return (None, False) + return (self.helper_furl, self.helper_connected) def build_one_ds(): ds = DownloadStatus("storage_index", 1234) @@ -535,8 +537,55 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi fileutil.make_dirs("web/test_welcome/private") return self.GET("/") d.addCallback(_check) + + #set furl not connected, furl is string 'None' + def _checkPreHelperNotConfigured1(res): + self.s.uploader.helper_furl = 'None' + return self.GET("/") + def _checkHelperNotConfigured1(res): + self.failUnlessIn('Connected to helper?: not configured',res); + + d.addCallback(_checkPreHelperNotConfigured1) + d.addCallback(_checkHelperNotConfigured1) + + #set furl not connected, furl is obj None + def _checkPreHelperNotConfigured2(res): + self.s.uploader.helper_furl = None + return self.GET("/") + def _checkHelperNotConfigured2(res): + self.failUnlessIn('Connected to helper?: not configured',res); + + d.addCallback(_checkPreHelperNotConfigured2) + d.addCallback(_checkHelperNotConfigured2) + + + + #enable helper, not connected + def _checkPreHelperNotConnected(res): + self.s.uploader.helper_furl = "someHelperFurl" + self.s.uploader.helper_connected = False + return self.GET("/") + def _checkHelperNotConnected(res): + self.failUnlessIn('Connected to helper?: no',res); + + d.addCallback(_checkPreHelperNotConnected) + d.addCallback(_checkHelperNotConnected) + + + #enable helper, connected + def _checkPreHelperConnected(res): + self.s.uploader.helper_furl = "someHelperFurl" + self.s.uploader.helper_connected = True + return self.GET("/") + def _checkHelperConnected(res): + self.failUnlessIn('Connected to helper?: yes',res); + + d.addCallback(_checkPreHelperConnected) + d.addCallback(_checkHelperConnected) + return d + def test_status(self): h = self.s.get_history() dl_num = h.list_all_download_statuses()[0].get_counter() diff --git src/allmydata/web/root.py src/allmydata/web/root.py index 2cd315d..1796d40 100644 --- src/allmydata/web/root.py +++ src/allmydata/web/root.py @@ -212,12 +212,23 @@ class Root(rend.Page): return None furl, connected = uploader.get_helper_info() return furl + + + def data_connected_to_helper_description(self,ctx,data): + val = self.data_connected_to_helper(ctx,data) + if val == "not-configured": + return "not configured" + return val + def data_connected_to_helper(self, ctx, data): try: uploader = self.client.getServiceNamed("uploader") except KeyError: return "no" # we don't even have an Uploader furl, connected = uploader.get_helper_info() + + if furl == 'None' or furl is None: + return "not-configured" if connected: return "yes" return "no" diff --git src/allmydata/web/static/tahoe.css src/allmydata/web/static/tahoe.css index 297bbe4..4157c61 100644 --- src/allmydata/web/static/tahoe.css +++ src/allmydata/web/static/tahoe.css @@ -52,6 +52,9 @@ legend { border: 1px solid #F00; background-color: #FBB; } +.connected-not-configured { + background-color: #FFF; +} .encoded, .nodeid { font-family: monospace; diff --git src/allmydata/web/welcome.xhtml src/allmydata/web/welcome.xhtml index 16f2cb7..464a46b 100644 --- src/allmydata/web/welcome.xhtml +++ src/allmydata/web/welcome.xhtml @@ -47,7 +47,7 @@
connected-
Helper:
-
Connected to helper?:
+
Connected to helper?:

Connected to