예제 #1
0
 def test_receive_logs():
     log_file_name = 'test_logging.log'
     lego = Lego(None, threading.Lock(), log_file_name)
     message = Message('Test Message 1',
                       Metadata(None).__dict__, True).__dict__
     lego.on_receive(message)
     with open(log_file_name, mode='r') as f:
         log = json.loads(f.read())
     assert log == message  # nosec
     os.remove(log_file_name)
예제 #2
0
 def test_receive_logs():
     log_file_name = 'test_logging.log'
     lego = Lego(None, threading.Lock(),
                 log_file_name)
     message = Message('Test Message 1',
                       Metadata(None).__dict__, True).__dict__
     lego.on_receive(message)
     with open(log_file_name, mode='r') as f:
         log = json.loads(f.read())
     assert log == message  # nosec
     os.remove(log_file_name)
예제 #3
0
 def test_on_receive_informs_children():
     log_file_name = 'test_child_informed.log'
     baseplate = Lego(None, threading.Lock())
     child = Lego.start(baseplate, threading.Lock(), log_file_name)
     baseplate.children.append(child)
     message = Message('Test Message 1',
                       Metadata(None).__dict__, True).__dict__
     baseplate.on_receive(message)
     child.stop()
     with open(log_file_name, mode='r') as f:
         log = json.loads(f.read())
     os.remove(log_file_name)
     assert log == message  # nosec
예제 #4
0
 def test_on_receive_informs_children():
     log_file_name = 'test_child_informed.log'
     baseplate = Lego(None, threading.Lock())
     child = Lego.start(baseplate, threading.Lock(), log_file_name)
     baseplate.children.append(child)
     message = Message('Test Message 1',
                       Metadata(None).__dict__, True).__dict__
     baseplate.on_receive(message)
     child.stop()
     with open(log_file_name, mode='r') as f:
         log = json.loads(f.read())
     os.remove(log_file_name)
     assert log == message  # nosec