Download:
child 167:2982debb99be
parent 165:7d1baf2f0b87
166:b55a7bba94ec
Anton Shestakov <av6@dwimlabs.net>, Tue, 19 Jul 2016 22:25:24 +0800
tests: test status badge

1 файлов изменено, 16 вставок(+), 0 удалений(-) [+]
tests/test_viewer.py file | annotate | diff | comparison | revisions
--- a/tests/test_viewer.py Tue Jul 19 22:22:48 2016 +0800
+++ b/tests/test_viewer.py Tue Jul 19 22:25:24 2016 +0800
@@ -1,4 +1,5 @@
from datetime import datetime
+from xml.etree import ElementTree
from pytest import raises
from tornado.web import HTTPError
@@ -61,3 +62,18 @@
response = self.fetch('/nobodyhere')
assert response.code == 404
assert 'online linter' in response.body
+
+ def test_status(self):
+ response = self.fetch('/butt.cloud/cyber/wizard-attack/status.svg')
+ assert response.code == 404
+ assert 'online linter' in response.body
+
+ 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 'height' in root.attrib
+ assert root.attrib['height'] == '20'
+ text = [el.text for el in root.findall('./svg:g/svg:text', ns)]
+ assert text[::2] == ['lint', '1 error', '1 warning']