Ejemplo n.º 1
0
 def test_substitute(self):
   """Do a simple substitution on the expected_command field"""
   substitute_parameters(self.layout, {"SOURCE_THING": "vim",
     "SOURCE_STEP": "source_step", "NEW_THING": "new_thing"})
   self.assertEqual(self.layout.steps[0].expected_materials[0][1], "vim")
   self.assertEqual(self.layout.steps[0].expected_materials[0][5], "source_step")
   self.assertEqual(self.layout.steps[0].expected_products[0][1], "new_thing")
   self.assertEqual(self.layout.inspect[0].expected_materials[0][1], "vim")
   self.assertEqual(self.layout.inspect[0].expected_materials[0][5], "source_step")
   self.assertEqual(self.layout.inspect[0].expected_products[0][1], "new_thing")
Ejemplo n.º 2
0
    def test_substitute_no_var(self):
        """Raise an error if the parameter is not filled-in"""

        with self.assertRaises(KeyError):
            substitute_parameters(self.layout, {"NOEDITOR": "vim"})
Ejemplo n.º 3
0
 def test_substitute(self):
     """Do a simple substitution on the expected_command field"""
     substitute_parameters(self.layout, {"EDITOR": "vim"})
     self.assertEquals(self.layout.steps[0].expected_command[0], "vim")
Ejemplo n.º 4
0
    def test_inspection_fail_with_non_zero_retval(self):
        """Check that the substitution raises TypeError if the key is missing"""

        with self.assertRaises(KeyError):
            substitute_parameters(self.layout, {})
Ejemplo n.º 5
0
 def test_substitute(self):
     """Check that the substitution is performed on the run field."""
     substitute_parameters(self.layout, {"COMMAND": "touch"})
     self.assertEquals(self.layout.inspect[0].run[0], "touch")