Пример #1
0
 def test_happy_path(self):
     os.environ['foo']='bar'
     self.assertEqual('bar',os.environ['foo'])
     self.template_file.write('[test]\nfoo:${foo}')
     self.template_file.flush()
     stillson.render(self.template_file.name,self.output_file)
     self.output_file.seek(0)
     self.assertEqual('[test]\nfoo:bar',self.output_file.read())
Пример #2
0
 def test_missing_variable(self):
     os.environ['foo']='bar'
     self.assertEqual('bar',os.environ['foo'])
     self.template_file.write('[test]\nfoo:${not_here}')
     self.template_file.flush()
     try:
         stillson.render(self.template_file.name,self.output_file)
         self.fail('missing variable to throw an exception')
     except stillson.StillsonMissingEnvVariable as e:
         self.assertIn('not_here',str(e)) #Todo expect line number