robotframework-2.7.7.utest.utils.test_htmlwriter.py Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of robotframework Show documentation
Show all versions of robotframework Show documentation
High level test automation framework
The newest version!
import os
import unittest
from StringIO import StringIO
from robot.utils import HtmlWriter
from robot.utils.asserts import assert_equals
class TestHtmlWriter(unittest.TestCase):
def setUp(self):
self.output = StringIO()
self.writer = HtmlWriter(self.output)
def test_start(self):
self.writer.start('r')
self._verify('\n')
def test_start_without_newline(self):
self.writer.start('robot', newline=False)
self._verify('')
def test_start_with_attribute(self):
self.writer.start('robot', {'name': 'Suite1'}, False)
self._verify('')
def test_start_with_attributes(self):
self.writer.start('test', {'class': '123', 'x': 'y', 'a': 'z'})
self._verify('\n')
def test_start_with_non_ascii_attributes(self):
self.writer.start('test', {'name': u'\xA7', u'\xE4': u'\xA7'})
self._verify(u'\n')
def test_start_with_quotes_in_attribute_value(self):
self.writer.start('x', {'q':'"', 'qs': '""""', 'a': "'"}, False)
self._verify('')
def test_start_with_html_in_attribute_values(self):
self.writer.start('x', {'1':'<', '2': '&', '3': '