Debian Codegraph @

test/unit/markup/any_test.py

raw
1 from unittest.mock import patch
2 from pytest import raises
3
4 from kiwi.markup.any import MarkupAny
5
6 from kiwi.exceptions import (
7 KiwiDescriptionInvalid,
8 KiwiAnyMarkupPluginError
9 )
10
11
12 class TestMarkupXML:
13 def setup(self):
14 self.markup = MarkupAny('../data/example_config.xml')
15
16 def setup_method(self, cls):
17 self.setup()
18
19 @patch('anymarkup_core.parse_file')
20 def test_raises_markup_conversion_error(self, mock_anymarkup_parse_file):
21 mock_anymarkup_parse_file.side_effect = Exception
22 with raises(KiwiDescriptionInvalid):
23 MarkupAny('../data/example_config.xml')
24
25 @patch('importlib.import_module')
26 def test_raises_anymarkup_not_available(self, mock_importlib):
27 mock_importlib.side_effect = Exception
28 with raises(KiwiAnyMarkupPluginError):
29 MarkupAny('../data/example_config.xml')
30
31 def test_get_xml_description(self):
32 assert 'xslt-' in self.markup.get_xml_description()
33
34 def test_get_yaml_description(self):
35 assert 'xslt-' in self.markup.get_yaml_description()
36
37 def test_get_toml_description(self):
38 assert 'xslt-' in self.markup.get_toml_description()