From ecb6651926d0e329c9d6bdcbd646df5523e09a84 Mon Sep 17 00:00:00 2001 From: David Stainton Date: Fri, 20 Jan 2017 08:49:35 +0000 Subject: [PATCH] Add basic unit test for json welcome page --- src/allmydata/test/web/test_web.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/allmydata/test/web/test_web.py b/src/allmydata/test/web/test_web.py index 1961f99ed..bff0dc001 100644 --- a/src/allmydata/test/web/test_web.py +++ b/src/allmydata/test/web/test_web.py @@ -184,10 +184,15 @@ class FakeDisplayableServer(StubServer): self.last_loss_time = last_loss_time self.last_rx_time = last_rx_time self.last_connect_time = last_connect_time + self.rref = None def on_status_changed(self, cb): # TODO: try to remove me cb(self) def is_connected(self): # TODO: remove me return self.connected + def get_version(self): + return { + "application-version": "" + } def get_permutation_seed(self): return "" def get_announcement(self): @@ -734,6 +739,15 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi def test_create(self): pass + def test_welcome_json(self): + d = self.GET("/?t=json") + def _check(res): + decoded = simplejson.loads(res) + self.failUnless("introducers" in decoded.keys()) + self.failUnless("servers" in decoded.keys()) + d.addCallback(_check) + return d + def test_welcome(self): d = self.GET("/") def _check(res):