changeset 126:c2877512beb8

Additional unit test for the {{{bitten.recipe}}} module.
author cmlenz
date Wed, 10 Aug 2005 11:44:58 +0000
parents 92e29e6b4c16
children a9443f673344
files bitten/tests/recipe.py
diffstat 1 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/tests/recipe.py
+++ b/bitten/tests/recipe.py
@@ -36,13 +36,29 @@
         self.recipe_xml.close()
         os.unlink(os.path.join(self.temp_dir, 'recipe.xml'))
 
-    def test_description(self):
+    def test_empty_recipe(self):
         self.recipe_xml.write('<?xml version="1.0"?>'
                               '<build description="test">'
                               '</build>')
         self.recipe_xml.close()
         recipe = Recipe(basedir=self.temp_dir)
         self.assertEqual('test', recipe.description)
+        self.assertEqual(self.temp_dir, recipe.ctxt.basedir)
+        steps = list(recipe)
+        self.assertEqual(0, len(steps))
+
+    def test_single_step(self):
+        self.recipe_xml.write('<?xml version="1.0"?>'
+                              '<build>'
+                              ' <step id="foo" description="Bar"></step>'
+                              '</build>')
+        self.recipe_xml.close()
+        recipe = Recipe(basedir=self.temp_dir)
+        steps = list(recipe)
+        self.assertEqual(1, len(steps))
+        self.assertEqual('foo', steps[0].id)
+        self.assertEqual('Bar', steps[0].description)
+        self.assertEqual('fail', steps[0].onerror)
 
 
 def suite():
Copyright (C) 2012-2017 Edgewall Software