diff options
Diffstat (limited to 'tests/test_template_parser.py')
-rw-r--r-- | tests/test_template_parser.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/test_template_parser.py b/tests/test_template_parser.py new file mode 100644 index 0000000..5cb6e2b --- /dev/null +++ b/tests/test_template_parser.py | |||
@@ -0,0 +1,36 @@ | |||
1 | #!/usr/bin/env python | ||
2 | from dingus import Dingus, DingusTestCase, DontCare | ||
3 | import nose.tools as nose_tools | ||
4 | from mrbelvedere import template_parser | ||
5 | from mrbelvedere.template_parser import TemplateParser | ||
6 | import yaml | ||
7 | |||
8 | class WhenSettingUp(DingusTestCase(TemplateParser, exclude=['yaml'])): | ||
9 | |||
10 | def setup(self): | ||
11 | super(WhenSettingUp, self).setup() | ||
12 | self.template_parser = TemplateParser() | ||
13 | |||
14 | def should_setup_yaml(self): | ||
15 | assert isinstance(self.template_parser.yaml, type(yaml)) | ||
16 | |||
17 | def should_degine_template_data_attribute(self): | ||
18 | assert self.template_parser.template_data is None | ||
19 | |||
20 | def should_define_file_attribute(self): | ||
21 | assert self.template_parser._current_template_file is None | ||
22 | |||
23 | def should_set_file_to_parse(self): | ||
24 | self.template_parser.template_file = 'examples/webserver.yaml' | ||
25 | assert self.template_parser.template_file is not None | ||
26 | |||
27 | def should_load_template(self): | ||
28 | self.template_parser.template_file = 'examples/webserver.yaml' | ||
29 | self.template_parser.load_template() | ||
30 | assert self.template_parser.template_data is not None | ||
31 | |||
32 | def should_raise_io_error(self): | ||
33 | try: | ||
34 | self.template_parser.template_file = 'examples/invalid_template.yaml' | ||
35 | except IOError: | ||
36 | assert True | ||