Skip to content

Commit

Permalink
Fix some failing web tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-sonestedt committed Dec 27, 2009
1 parent 6f87f89 commit fe4efb8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
6 changes: 6 additions & 0 deletions buildbot/status/web/build.py
@@ -1,5 +1,6 @@

from twisted.web import html
from twisted.web.error import NoResource
from twisted.web.util import Redirect, DeferredResource
from twisted.internet import defer, reactor

Expand All @@ -12,6 +13,8 @@
from buildbot.status.web.step import StepsResource
from buildbot import util



# /builders/$builder/builds/$buildnum
class StatusResourceBuild(HtmlResource):
addSlash = True
Expand Down Expand Up @@ -208,6 +211,9 @@ def __init__(self, builder_status, builder_control):
self.builder_status = builder_status
self.builder_control = builder_control

def content(self, req, cxt):
return "subpages shows data for each build"

def getChild(self, path, req):
try:
num = int(path)
Expand Down
15 changes: 14 additions & 1 deletion buildbot/test/test_web.py
Expand Up @@ -283,14 +283,27 @@ def test_urls(self):
s = setupBuildStepStatus("test_web.test_urls")
s.addURL("coverage", "http://coverage.example.org/target")
s.addURL("icon", "http://coverage.example.org/icon.png")


class FakeService:
import jinja2
templates = jinja2.Environment(loader=jinja2.PackageLoader('buildbot.status.web', 'templates'),
extensions=['jinja2.ext.i18n'],
trim_blocks=True)

class FakeSite:
buildbot_service = FakeService()

class FakeRequest:
site = FakeSite()
prepath = []
postpath = []
def childLink(self, name):
return name

req = FakeRequest()
box = waterfall.IBox(s).getBox(req)
text = "\n".join(box.td()['text'])
text = box.td()['text']
e1 = '[<a href="http://coverage.example.org/target" class="BuildStep external">coverage</a>]'
self.failUnlessSubstring(e1, text)
e2 = '[<a href="http://coverage.example.org/icon.png" class="BuildStep external">icon</a>]'
Expand Down

0 comments on commit fe4efb8

Please sign in to comment.