Exemplo n.º 1
0
    def test_execute_raises(self):
        cmd = ['ls', '/invalid']
        with self.assertRaises(Exception) as context:
            util.execute(cmd)

        # TODO(retr0h): Don't assume test OS.
        # OSX:
        # ls: /invalid: No such file or directory\n
        # Travis:
        # ls: cannot access /invalid: No such file or directory\n
        self.assertRegexpMatches(context.exception.message,
                                 r'.* No such file or directory\n')
Exemplo n.º 2
0
    def test_execute(self):
        cmd = ['test', 'true']
        result = util.execute(cmd)

        self.assertEquals(True, result)