--- a/tests/test_viewer.py Mon Sep 18 16:54:55 2017 +0800
+++ b/tests/test_viewer.py Mon Sep 18 17:07:32 2017 +0800
from viewer import CandolintViewer
+ 'atom': 'http://www.w3.org/2005/Atom',
+ 'svg': 'http://www.w3.org/2000/svg'
with database.transaction():
project = Project.create(
assert response.code == 200
assert 'atom+xml' in response.headers['Content-Type']
root = ElementTree.fromstring(response.body)
- ns = {'atom': 'http://www.w3.org/2005/Atom'}
- title = root.find('./atom:entry/atom:title', ns)
+ assert root.tag == '{%s}%s' % (XMLNS['atom'], 'feed')
+ title = root.find('./atom:entry/atom:title', XMLNS)
assert title.text.startswith('Check #')
assert title.text.endswith(' 1 error, 1 warning')
- updates = [el.text for el in root.findall('.//atom:updated', ns)]
+ updates = [el.text for el in root.findall('.//atom:updated', XMLNS)]
assert len(updates) == min(Check.select().count(), 20) + 1
assert updates[0] == updates[1] == '2016-08-20T02:38:53Z'
response = self.fetch('/example.com/alice/test-viewer/status.svg')
assert response.code == 200
root = ElementTree.fromstring(response.body)
- ns = {'svg': 'http://www.w3.org/2000/svg'}
- assert root.tag == '{http://www.w3.org/2000/svg}svg'
+ assert root.tag == '{%s}%s' % (XMLNS['svg'], 'svg')
assert root.attrib.get('height') == '20'
- text = [el.text for el in root.findall('./svg:g/svg:text', ns)]
+ text = [el.text for el in root.findall('./svg:g/svg:text', XMLNS)]
assert text[::2] == ['lint', '1 error', '1 warning']
response = self.fetch('/example.com/alice/test-viewer/latest/dot.svg')
assert response.code == 200
root = ElementTree.fromstring(response.body)
- ns = {'svg': 'http://www.w3.org/2000/svg'}
- assert root.tag == '{http://www.w3.org/2000/svg}svg'
+ assert root.tag == '{%s}%s' % (XMLNS['svg'], 'svg')
assert root.attrib.get('height') == '12'
- circles = root.findall('./svg:circle', ns)
+ circles = root.findall('./svg:circle', XMLNS)
assert circles[0].attrib.get('fill').startswith('#')