def test_command(self): t = {'command_name': 'check_command_test', 'command_line': '/tmp/dummy_command.sh $ARG1$ $ARG2$', 'poller_tag': 'DMZ' } c = Command(t) self.assert_(c.command_name == 'check_command_test') b = c.get_initial_status_brok() self.assert_(b.type == 'initial_command_status') # now create a commands packs cs = Commands([c]) dummy_call = "check_command_test!titi!toto" cc = CommandCall(cs, dummy_call) self.assert_(cc.is_valid() == True) self.assert_(cc.command == c) self.assert_(cc.poller_tag == 'DMZ')
def test_command(self): t = {'command_name': 'check_command_test', 'command_line': '/tmp/dummy_command.sh $ARG1$ $ARG2$', 'poller_tag': 'DMZ' } c = Command(t) self.assertEqual('check_command_test', c.command_name) b = c.get_initial_status_brok() self.assertEqual('initial_command_status', b.type) # now create a commands packs cs = Commands([c]) dummy_call = "check_command_test!titi!toto" cc = CommandCall(cs, dummy_call) self.assertEqual(True, cc.is_valid()) self.assertEqual(c, cc.command) self.assertEqual('DMZ', cc.poller_tag)
def manage_initial_command_status_brok(self, b): data = b.data c_id = data['id'] #print "Creating Command:", c_id, data c = Command({}) self.update_element(c, data) #print "CMD:", c self.commands[c_id] = c self.number_of_objects += 1