Beispiel #1
0
 def test_find(self):
     """
     It can find scripts
     """
     p = FilePath('foo')
     runner = ScriptRunner(p.path, None)
     
     self.assertEqual(runner.find('something'), p.child('something'))
     self.assertEqual(runner.find('a/b'), p.child('a').child('b'))
     self.assertRaises(InsecurePath, runner.find, '../a')
     self.assertRaises(InsecurePath, runner.find, 'a/../../b')
Beispiel #2
0
 def test_run(self):
     """
     You can run scripts in a directory
     """
     runner = ScriptRunner('something', 'ch3_logger')
     runner.find = create_autospec(runner.find,
                                   return_value=FilePath('the script'))
     runner.spawn = create_autospec(runner.spawn,
                                    return_value='spawn ret')
     
     r = runner.run('joe', ['a', 'b'], 'stdin stuff')
     
     runner.find.assert_called_with('joe')
     runner.spawn.assert_called_with('joe',
                                     FilePath('the script').path,
                                     ['a', 'b'],
                                     'stdin stuff')
     self.assertEqual(r, 'spawn ret')