コード例 #1
0
ファイル: test_action.py プロジェクト: HubLot/shinken
    def test_got_pipe_shell_characters(self):
        a = Action()
        a.timeout = 10
        a.command = "libexec/dummy_command_nobang.sh | grep 'Please do not use me directly'"
        a.env = {}
        if os.name == 'nt':
            return
        self.assertEqual(True, a.got_shell_characters())
        a.execute()

        self.assertEqual('launched', a.status)
        self.wait_finished(a)
        print "F**k", a.status, a.output
        self.assertEqual(0, a.exit_status)
        self.assertEqual('done', a.status)
コード例 #2
0
ファイル: test_action.py プロジェクト: zoranzaric/shinken
    def test_got_shell_characters(self):
        a = Action()
        a.timeout = 10
        a.command = "libexec/dummy_command_nobang.sh && echo finished ok"
        a.env = {}
        if os.name == 'nt':
            return
        self.assert_(a.got_shell_characters() == True)
        a.execute()

        self.assert_(a.status == 'launched')
        self.wait_finished(a)
        print "F**k", a.status, a.output
        self.assert_(a.exit_status == 0)
        self.assert_(a.status == 'done')
コード例 #3
0
ファイル: test_action.py プロジェクト: HubLot/shinken
    def test_noshell_bang_command(self):
        a = Action()
        a.timeout = 10
        a.command = "libexec/dummy_command_nobang.sh"
        a.env = {}
        if os.name == 'nt':
            return
        self.assertEqual(False, a.got_shell_characters())
        a.execute()

        self.assertEqual('launched', a.status)
        self.wait_finished(a)
        print "F**k", a.status, a.output
        self.assertEqual(0, a.exit_status)
        self.assertEqual('done', a.status)
コード例 #4
0
ファイル: test_action.py プロジェクト: zoranzaric/shinken
    def test_noshell_bang_command(self):
        a = Action()
        a.timeout = 10
        a.command = "libexec/dummy_command_nobang.sh"
        a.env = {}
        if os.name == 'nt':
            return
        self.assert_(a.got_shell_characters() == False)
        a.execute()

        self.assert_(a.status == 'launched')
        self.wait_finished(a)
        print "F**k", a.status, a.output
        self.assert_(a.exit_status == 0)
        self.assert_(a.status == 'done')
コード例 #5
0
    def test_got_pipe_shell_characters(self):
        a = Action()
        a.timeout = 10
        a.command = "libexec/dummy_command_nobang.sh | grep 'Please do not use me directly'"
        a.env = {}
        if os.name == 'nt':
            return
        self.assert_(a.got_shell_characters() == True)
        a.execute()

        self.assert_(a.status == 'launched')
        self.wait_finished(a)
        print "F**k", a.status, a.output
        self.assert_(a.exit_status == 0)
        self.assert_(a.status == 'done')
コード例 #6
0
    def test_got_shell_characters(self):
        a = Action()
        a.timeout = 10
        a.command = "libexec/dummy_command_nobang.sh && echo finished ok"
        a.env = {}
        if os.name == 'nt':
            return
        self.assertEqual(True, a.got_shell_characters())
        a.execute()

        self.assertEqual('launched', a.status)
        self.wait_finished(a)
        print "F**k", a.status, a.output
        self.assertEqual(0, a.exit_status)
        self.assertEqual('done', a.status)
コード例 #7
0
ファイル: test_action.py プロジェクト: zoranzaric/shinken
    def test_action(self):
        a = Action()
        a.timeout = 10
        a.env = {}

        if os.name == 'nt':
            a.command = r'libexec\\dummy_command.cmd'
        else:
            a.command = "libexec/dummy_command.sh"
        self.assert_(a.got_shell_characters() == False)
        a.execute()
        self.assert_(a.status == 'launched')
        #Give also the max output we want for the command
        self.wait_finished(a)
        self.assert_(a.exit_status == 0)
        self.assert_(a.status == 'done')
        self.assert_(a.output == "Hi, I'm for testing only. Please do not use me directly, really")
        self.assert_(a.perf_data == "Hip=99% Bob=34mm")
コード例 #8
0
    def test_action(self):
        a = Action()
        a.timeout = 10
        a.env = {}

        if os.name == 'nt':
            a.command = r'libexec\\dummy_command.cmd'
        else:
            a.command = "libexec/dummy_command.sh"
        self.assertEqual(False, a.got_shell_characters())
        a.execute()
        self.assertEqual('launched', a.status)
        # Give also the max output we want for the command
        self.wait_finished(a)
        self.assertEqual(0, a.exit_status)
        self.assertEqual('done', a.status)
        print a.output
        self.assertEqual("Hi, I'm for testing only. Please do not use me directly, really", a.output)
        self.assertEqual("Hip=99% Bob=34mm", a.perf_data)
コード例 #9
0
ファイル: test_action.py プロジェクト: zoranzaric/shinken
    def test_environnement_variables(self):
        a = Action()
        a.timeout = 10
        if os.name == 'nt':
            return
        else:
            a.command = "/usr/bin/env"
        a.env = {'TITI' : 'est en vacance'}

        self.assert_(a.got_shell_characters() == False)

        a.execute()

        self.assert_(a.status == 'launched')
        #Give also the max output we want for the command
        self.wait_finished(a)
        print "Output", a.long_output, a.output
        titi_found = False
        for l in a.long_output.splitlines():
            if l == 'TITI=est en vacance':
                titi_found = True

        self.assert_(titi_found == True)
コード例 #10
0
ファイル: test_action.py プロジェクト: zoranzaric/shinken
    def test_environnement_variables(self):
        a = Action()
        a.timeout = 10
        if os.name == 'nt':
            return
        else:
            a.command = "/usr/bin/env"
        a.env = {'TITI': 'est en vacance'}

        self.assert_(a.got_shell_characters() == False)

        a.execute()

        self.assert_(a.status == 'launched')
        #Give also the max output we want for the command
        self.wait_finished(a)
        print "Output", a.long_output, a.output
        titi_found = False
        for l in a.long_output.splitlines():
            if l == 'TITI=est en vacance':
                titi_found = True

        self.assert_(titi_found == True)