blob: 5cb6e2ba3edfb22d83041e04befe933295a56297 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#!/usr/bin/env python
from dingus import Dingus, DingusTestCase, DontCare
import nose.tools as nose_tools
from mrbelvedere import template_parser
from mrbelvedere.template_parser import TemplateParser
import yaml
class WhenSettingUp(DingusTestCase(TemplateParser, exclude=['yaml'])):
def setup(self):
super(WhenSettingUp, self).setup()
self.template_parser = TemplateParser()
def should_setup_yaml(self):
assert isinstance(self.template_parser.yaml, type(yaml))
def should_degine_template_data_attribute(self):
assert self.template_parser.template_data is None
def should_define_file_attribute(self):
assert self.template_parser._current_template_file is None
def should_set_file_to_parse(self):
self.template_parser.template_file = 'examples/webserver.yaml'
assert self.template_parser.template_file is not None
def should_load_template(self):
self.template_parser.template_file = 'examples/webserver.yaml'
self.template_parser.load_template()
assert self.template_parser.template_data is not None
def should_raise_io_error(self):
try:
self.template_parser.template_file = 'examples/invalid_template.yaml'
except IOError:
assert True
|