self.add_service(ws)
vd = self.getServiceNamed("vdrive")
startfile = os.path.join(self.basedir, "start.html")
+ nodeurl_file = os.path.join(self.basedir, "node.url")
d = vd.when_private_root_available()
- d.addCallback(ws.create_start_html, startfile)
+ d.addCallback(ws.create_start_html, startfile, nodeurl_file)
def _check_hotline(self, hotline_file):
self.s.basedir = 'web/test_welcome'
fileutil.make_dirs("web/test_welcome")
self.ws.create_start_html("private_uri",
- "web/test_welcome/start.html")
+ "web/test_welcome/start.html",
+ "web/test_welcome/node.url")
return self.GET("/")
d.addCallback(_check)
def _check2(res):
def test_start_html(self):
fileutil.make_dirs("web")
startfile = "web/start.html"
- self.ws.create_start_html("private_uri", startfile)
+ nodeurlfile = "web/node.url"
+ self.ws.create_start_html("private_uri", startfile, nodeurlfile)
self.failUnless(os.path.exists(startfile))
start_html = open(startfile, "r").read()
private_url = self.webish_url + "/uri/private_uri"
self.failUnless(private_url in start_html)
+ self.failUnless(os.path.exists(nodeurlfile))
+ nodeurl = open(nodeurlfile, "r").read().strip()
+ self.failUnless(nodeurl.startswith("http://localhost"))
+
def test_GET_FILEURL(self):
d = self.GET("/vdrive/global/foo/bar.txt")
d.addCallback(self.failUnlessIsBarDotTxt)
# apparently 'ISite' does not exist
#self.site._client = self.parent
- def create_start_html(self, private_uri, startfile):
+ def create_start_html(self, private_uri, startfile, nodeurl_file):
f = open(startfile, "w")
os.chmod(startfile, 0600)
template = open(util.sibpath(__file__, "web/start.html"), "r").read()
}
f.write(template % fields)
f.close()
+
+ f = open(nodeurl_file, "w")
+ # this file is world-readable
+ f.write(base_url + "\n")
+ f.close()
+