pungi/tests/test_variant_wrapper.py
Haibo Lin 3eddcfccd8 Fix flake8 complaints - F401
F401 'dnf' imported but unused
F401 'imp' imported but unused
F401 'os' imported but unused
F401 'subprocess' imported but unused
F401 'sys' imported but unused
F401 'yum' imported but unused

JIRA: COMPOSE-4108
Signed-off-by: Haibo Lin <hlin@redhat.com>
2020-02-07 11:48:31 +08:00

32 lines
890 B
Python

# -*- coding: utf-8 -*-
try:
import unittest2 as unittest
except ImportError:
import unittest
from six.moves import cStringIO
from pungi.wrappers.variants import VariantsXmlParser
VARIANTS_WITH_WHITESPACE = """
<variants>
<variant id="Foo" name="Foo" type="variant">
<arches><arch>x86_64 </arch></arches>
<groups><group> core</group></groups>
<environments><environment> foo </environment></environments>
</variant>
</variants>
"""
class TestVariantsXmlParser(unittest.TestCase):
def test_whitespace_in_file(self):
input = cStringIO(VARIANTS_WITH_WHITESPACE)
with self.assertRaises(ValueError) as ctx:
VariantsXmlParser(input)
self.assertIn("Tag arch on line 4", str(ctx.exception))
self.assertIn("Tag group on line 5", str(ctx.exception))
self.assertIn("Tag environment on line 6", str(ctx.exception))