correct some error on test

This commit is contained in:
AleaJactaEst 2018-08-16 21:08:37 +02:00
parent 364f97adf2
commit ecd312fb9a
4 changed files with 23 additions and 8 deletions

View file

@ -553,5 +553,6 @@ def main(arguments=sys.argv[1:]):
organization_name=args.organization_name, organization_name=args.organization_name,
common_name=args.common_name) common_name=args.common_name)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View file

@ -427,5 +427,6 @@ def main(args=sys.argv[1:]):
password_comand_line=param.password_comand_line, password_comand_line=param.password_comand_line,
password=param.password) password=param.password)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View file

@ -800,6 +800,7 @@ class Manager():
""" """
def __init__(self, launch_program): def __init__(self, launch_program):
self.threadCommand = [] self.threadCommand = []
self.info = {}
self.command = [] self.command = []
self.launch_program = launch_program self.launch_program = launch_program
self.param = {} self.param = {}
@ -965,6 +966,16 @@ class Manager():
event)) event))
threadCommand.start() threadCommand.start()
self.threadCommand.append(threadCommand) self.threadCommand.append(threadCommand)
self.info.setdefault(name, {'queueIn': queueIn,
'queueOut': queueOut,
'event': event,
'threadCommand': threadCommand,
'command': self.param[name]['command'],
'path': self.param[name]['path'],
'logsize': self.param[name]['logsize'],
'bufsize': self.param[name]['bufsize']})
if self.launch_program: if self.launch_program:
event.set() event.set()
queueIn.put("START") queueIn.put("START")
@ -1059,5 +1070,6 @@ def main(args=sys.argv[1:]):
launch_program=param.launch_program, launch_program=param.launch_program,
show_log_console=param.show_log_console) show_log_console=param.show_log_console)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View file

@ -478,10 +478,10 @@ class TestManager(unittest.TestCase):
manage.serverHttp = MockServerHttp() manage.serverHttp = MockServerHttp()
manage._load_config(config) manage._load_config(config)
manage.launch_command() manage.launch_command()
for key in manage.info:
queueIn = manage.threadCommand[0]._args[5] queueIn = manage.info[key]['queueIn']
queueOut = manage.threadCommand[0]._args[6] queueOut = manage.info[key]['queueOut']
event = manage.threadCommand[0]._args[7] event = manage.info[key]['event']
queueIn.put("START") queueIn.put("START")
event.set() event.set()
@ -564,9 +564,10 @@ class TestManager(unittest.TestCase):
manage._load_config(config) manage._load_config(config)
manage.launch_command() manage.launch_command()
queueIn = manage.threadCommand[0]._args[5] key = list(manage.info.keys())[0]
queueOut = manage.threadCommand[0]._args[6] queueIn = manage.info[key]['queueIn']
event = manage.threadCommand[0]._args[7] queueOut = manage.info[key]['queueOut']
event = manage.info[key]['event']
signal.alarm(10) signal.alarm(10)
event.set() event.set()
@ -625,7 +626,7 @@ class TestManager(unittest.TestCase):
manage._set_headers() manage._set_headers()
manage.send_response.assert_called_with(200) manage.send_response.assert_called_with(200)
manage.send_header.assert_called_with('Content-type', 'application/json') # manage.send_header.assert_called_with('Content-type', 'application/json')
@patch.object(http.server.SimpleHTTPRequestHandler, '__init__') @patch.object(http.server.SimpleHTTPRequestHandler, '__init__')
def test_run_manage_command_log_1(self, init): def test_run_manage_command_log_1(self, init):