939
941
page = client.load_page(html_path)
940
942
if page.return_code == page.CODE_FAIL:
942
markup = page.content
944
# Data is a dict (type=report)
945
# with 1 or more dicts (type=testcase)
946
# with 1 for more dicts (type=test).
947
report = simplejson.loads(page.content)
948
if report.get('type', None) != 'complete':
949
# Did not get a report back.
943
951
self._yui_results = {}
944
# Maybe testing.pages should move to lp to avoid circular imports.
945
from canonical.launchpad.testing.pages import find_tags_by_class
946
entries = find_tags_by_class(
947
markup, 'yui3-console-entry-TestRunner')
948
for entry in entries:
949
category = entry.find(
950
attrs={'class': 'yui3-console-entry-cat'})
953
result = category.string
954
if result not in ('pass', 'fail'):
956
message = entry.pre.string
957
test_name, ignore = message.split(':', 1)
958
self._yui_results[test_name] = dict(
959
result=result, message=message)
952
for key, value in report['results'].items():
953
if isinstance(value, dict) and value['type'] == 'testcase':
956
for key, value in test_case.items():
957
if isinstance(value, dict) and value['type'] == 'test':
958
test_name = '%s.%s' % (testcase_name, key)
960
self._yui_results[test_name] = dict(
961
result=test['result'], message=test['message'])
961
963
def checkResults(self):
962
964
"""Check the results.